Reply

WAPI DNS & Next IP reserve

Techie
Posts: 11
4348     1

I am new to this API and find the documentation to be very comlex, missing standard JSON schema for objects. I'm a little confused on using the WAPI to complete a DNS & next IP reservation. 

 

Does anyone have an example of this?

Is it done in two parts or can it be done by just using the /wapi/v.x.x/record:host?

How does one initiate a login, etc?

 

Your help is much appreciated!

Re: WAPI DNS & Next IP reserve

Adviser
Posts: 101
4348     1

Here is a curl example using the function nextavialableip().

 

curl -k -u admin:infoblox -H "Content-Type: application/json" -X POST https://192.168.0.12/wapi/v1.4/record:host?_return_fields=ipv4addrs -d '{ "name":"host66.test.net", "ipv4addrs":[{"ipv4addr":"func:nextavailableip:192.168.32.0/24", "mac":"cafedeadbeef"}]}'

 

When xou add ?return_fields=ipv4addrs then you get immediatelly back the IP of the new object.

 

Obviously, you need to add this into any script or orchestration tool.

 

HTH.

Re: WAPI DNS & Next IP reserve

Techie
Posts: 11
4348     1

Thanks for the fast response. The version of my API is 2.6, would that differ much or should the example you provide be compatible? Also, can this work in a subzone, example hostname1.phone.lab.domain.net ?

Re: WAPI DNS & Next IP reserve

Adviser
Posts: 101
4348     1

@thefilmguy wrote:

Thanks for the fast response. The version of my API is 2.6, would that differ much or should the example you provide be compatible? Also, can this work in a subzone, example hostname1.phone.lab.domain.net ?


 

It will be compatible.

Just for complete reference, your GM also has next to the 2.6 also still the older versions available (1.0, 1.2, 1.3 etc).

 

Of course, it will also work with subzones, as long as they are added as Authoritative Zones on the Grid and you need to use the full FQDN for adding the record.

Re: WAPI DNS & Next IP reserve

Techie
Posts: 11
4348     1

Thank you. Turns out the view needed to be defined. 

 

curl -k1 -u admin:infobloxpw! -H "Content-Type: application/json" \
-X POST https://10.10.1.12/wapi/v2.6/record:host -d \
'{
"ipv4addrs":[{"ipv4addr":"func:nextavailableip:'$NETWORK'/21","mac":"'$MACADDRESS'"}],
"name":"'$HOSTNAME'",
"view": "default"
}'
Showing results for 
Search instead for 
Did you mean: 

Recommended for You