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 Examples

Reply

Removing host record via API without referencing ref value

Techie
Posts: 3
3941     0

I've got an API from 3rd party VPN appliance that manages the IP pool and it's able to do a record:host in the API but I'm also looking to remove the record on VPN disconnect.

 

Currently use this API to put record in:

 

curl -k -u admin:infoblox -H "content-type: application/json" -X POST "https://10.10.10.10/wapi/v2.10.3/record:host?_return_fields%2B=name,ipv4addrs,&_return_as_object=1" -d "{""name"":""example.company.com"",""ipv4addrs"": [{""ipv4addr"":""10.20.20.20""}]}"

 

One liner curl command would ideally query "example.company.com" and delete.

Re: Removing host record via API without referencing ref value

Adviser
Posts: 179
3941     0

Hi,

 

You can use the following multiple object request command to query and delete a host record in a single API call.

 

curl -k -u admin:infoblox -H 'content-type:application/json' -X POST "https://grid-master/wapi/v2.11/request" -d '[{"method": "STATE:ASSIGN","data":{"host_name":"example.infoblox.com"}},{"method":"GET","object": "record:host","data": {"name":"##STATE:host_name:##"},"assign_state": {"host_ref": "_ref"},"enable_substitution": true,"discard": true},{ "method": "DELETE", "object": "##STATE:host_ref:##","enable_substitution": true,"discard": true},{"method": "STATE:DISPLAY"}]'

For more information on mulitple object requests, you can take a look at this blog.

 

Hope this is helpful,

Regards,

Krishna Vasudevan

Re: Removing host record via API without referencing ref value

Techie
Posts: 3
3941     0

This is working as expected but ran into one issue, the hostname is case sensitive "example.infoblox.com" is there a way to make the GET case insensitive so "EXAMPLE.infoblox.com" or "example.infoblox.com" works from this online CURL command.

 

curl -k -u admin:infoblox -H 'content-type:application/json' -X POST "https://grid-master/wapi/v2.11/request" -d '[{"method": "STATE:ASSIGN","data":{"host_name":"example.infoblox.com"}},{"method":"GET","object": "record:host","data": {"name":"##STATE:host_name:##"},"assign_state": {"host_ref": "_ref"},"enable_substitution": true,"discard": true},{ "method": "DELETE", "object": "##STATE:host_ref:##","enable_substitution": true,"discard": true},{"method": "STATE:DISPLAY"}]'

Re: Removing host record via API without referencing ref value

Community Manager
Community Manager
Posts: 182
3941     0

Use a case-insensitive search.  The search modifier goes immediately after the field being searched, within the quotes.  The difference is subdtle.

 

You want

 

{"name:":"##STATE:host_name:##"}

instead of

 

{"name":"##STATE:host_name:##"}

 

Re: Removing host record via API without referencing ref value

Techie
Posts: 3
3941     0

Perfect! thank you

Showing results for 
Search instead for 
Did you mean: 

Recommended for You