Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

API & Integration

Accepted Solution

Need some serious help with query (hopefully curl)

Posts: 1
5404     0

I need to query my database (over 1 million IP) and get all IP addresses with type=static where the network comment = X - I need to be able to change this for the various sites that we work on.

curl is fine or so is python. 

I just need the IP address as I have to then use that to query against another system to come up with the switch port it's attached to then make a list for the site to review.


Any help would be greately appreciated, I am not a coder by any means and I have no internal help to get this done. Clicking on the gui for weeks to get this figured out is not my idea of a good time. Smiley Happy


Re: Need some serious help with query (hopefully curl)

Posts: 40
5404     0

You'll need a script that first gets the networks that match your search (Network Comment = x) and then for each network looks up the IPs.


An example curl command to get the networks is


curl -k1 -u ibuser -X GET 'https://gridmaster/wapi/v1.4/network?comment=x'

example response:



        "_ref": "network/ZG5zLm5ldHdvcmskMTAuMTAuMTAuMC8yNC8w:", 

        "comment": "x", 

        "network": "", 

        "network_view": "default"



        "_ref": "network/ZG5zLm5ldHdvcmskMTAuMTAuMjAuMC8yNC8w:", 

        "comment": "x", 

        "network": "", 

        "network_view": "default"



An example curl command to get the USED IPs for a given network is (e.g., network =


curl -k1 -u ibuser -X GET 'https://gridmaster/wapi/v1.4/ipv4address?network='


If you want to limit this to specific record types (e.g., Fixed Address), then add Types to the search:


curl -k1 -u ibuser -X GET 'https://gridmaster/wapi/v1.4.1/ipv4address?network='


Replace "ibuser" above with your Infoblox admin account and "gridmaster" with your Grid Master IP or FQDN.


Note that the above is an exact search.  If you want a case insensitive search for the comment use := or regular expression use ~= or both :~ if you want case insensitive regular expression



curl -k1 -u ibuser -X GET 'https://gridmaster/wapi/v1.4/network?comment:=x' (matches x or X)

curl -k1 -u ibuser -X GET 'https://gridmaster/wapi/v1.4/network?comment~=x' (matches "extra", "exact", "x", etc but not "Xacto")

curl -k1 -u ibuser -X GET 'https://gridmaster/wapi/v1.4/network?comment:~=x' (matches "extra", "exact", "x", etc and "Xacto")



Re: Need some serious help with query (hopefully curl)

Posts: 15
5404     0

A kicker that gets me when extracting a possible large number is the max limit, &_max_results=1000


With curl it's then handy to use -o filename.txt which can then be processed by scripts.

Showing results for 
Search instead for 
Do you mean 

Recommended for You