BatmanAMA / powerbox

Netbox powershell module
MIT License
48 stars 18 forks source link

Module doesn't allow large API Querys #12

Closed RobinBeismann closed 5 years ago

RobinBeismann commented 6 years ago

Hi again,

is it possible to implement either a parameter or a settings variable for the request limit? The GET Parameter for this is ?limit=number, for example ?limit=0 will return unlimited much results, useful for IP Address requests and stuff like that. I've added it a new line at line 73 in Invoke-nbAPI.ps1 setting $Query["limit"] = "0" so it gets attached to the request, however I'm sure there are cleaner ways.

BatmanAMA commented 6 years ago

Hey Robin. - I just put out a prerelease version to address your issues if you'd like to test it out. I plan on finishing it and publishing to PSGallery early next week.

RobinBeismann commented 6 years ago

Hey Josh,

I'll try it out once I'm at work again (on vacation right now), we're using this modul to import VMs, NICs, Subnets and IPs from the System Center Virtual Machine Manager into Netbox.

BatmanAMA commented 6 years ago

That's awesome! I'm running into some of the same bugs you are, working on a similar process for VMware and SCCM. Planning on working on a SCVMM one shortly, but it's a bit lower in priority as the size of our Hyper-V environment is minuscule in comparison. I am generalizing the VMWare stuff to allow me to put it out here, and will likely generalize the SCCM stuff a bit later this week.

I patched a few more bugs this morning and the prerelease version out there should be up to current edits. I also added an additional optional parameter to "Connect-nbAPI" to specify page size when querying (-QueryLimit). Now that I have paging, I find the 50 item pages quite slow in comparison to larger ones. I'm going to continue developing with the prerelease of 2.2.x and see if I stumble into more bugs, and publish it live around Wednesday if everything is going smooth.

RobinBeismann commented 6 years ago

Yes, this worked, thanks. However you didn't merge in the patch for the #11 yet, did you? I had to remote the clause which disables authentication for GET Requests.

BatmanAMA commented 6 years ago

Good call out, I changed a bunch of stuff in the begin block, but somehow missed the part where I actually avoid adding the token... Just patched it quick and it's rebuilding now. There should be a new prerelease version available. FWIW, we just changed our netbox to require login so I actually will be testing this change against a real netbox instance (see #15 as far as my testing woes)