Are you interested in our Early Access Program (EAP)? This program allows you to preview code, test in your lab and provide feedback prior to General Availability (GA) release of all Infoblox products. If so, please click the link here.

API & Integration, DevOps,NetOps,SecOps

Reply

Curl - Get Next Available IP

Member
Posts: 1
1411     0

Hello,

 

We would like to use script to get the next available IP from a subnet "192.168.1.1". From the refernece guide, the script should be:

 

curl -k -u admin:infoblox -H 'content-type: application/json' -X POST "https://gridmaster/wapi/v2.11/network/ZG5zLm5ldHdvcmskMTcyLjIxLjEwLjAvMjQvMA:172.21.10.0/24/default?...
=next_available_ip&_return_as_object=1" -d '{"num":1}'

 

I know "ZG5zLm5ldHdvcmskMTcyLjIxLjEwLjAvMjQvMA:1921.168.1.1/24/default" is the object reference of the subnet 192.168.1.1.

 

However, how I can get this object reference and then pass as parameter to the above command? 

 

Great if anyone can share the sample for this.

 

Thanks.

 

Raymond.

 

 

 

Re: Curl - Get Next Available IP

Adviser
Posts: 181
1412     0

Hi,

 

You can combine multiple WAPI calls to achieve your requirement using the /request handler:

curl -X POST 'https://grid-master/wapi/v2.11/request' \
-k -u uname:pwd \
-H 'Content-Type: application/json' \
-d '[
    {
		"method": "GET",
		"object": "network",
        "data":
        {
            "network":"192.168.1.1/24"
        },
        "assign_state": 
		{
			"network_ref": "_ref"
		},
        "discard": true
	},
    {
		"method": "POST",
		"object": "##STATE:network_ref:##",
		"args": 
		{
			"_function": "next_available_ip"
		},
		"enable_substitution": true
    }
]'

Regards,

Krishna

Showing results for 
Search instead for 
Did you mean: 

Recommended for You