- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Removing host record via API without referencing ref value
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2020 07:39 PM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2020 09:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2020 10:50 AM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 01:40 PM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2020 05:37 PM
Perfect! thank you
Re: Removing host record via API without referencing ref value
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 11:01 AM
I'm execute:
curl -k -u admin:infoblox -H 'content-type:application/json' -X POST "https://10.20.20.239/wapi/v2.12.2/request" -d '[{"method": "STATE:ASSIGN","data":{"host_name":"teste.mydomain"}},{"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": "STATEISPLAY"}]'
But I'm getting this error:
{ "Error": "AdmConProtoError: None ('NoneType' object is not iterable)",
"code": "Server.Ibap.Internal",
"text": "Internal Error"
}curl: (3) unmatched close brace/bracket in URL position 65:
STATE:ASSIGN,data:{host_name:teste.mydomain}},{method:GET,object:
^
Could you help in order to understand what is the error ?