- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Urgent: API to delete Host record
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2019 10:36 AM
Hi Team,
I am looking to delete a host record with name "dmoc23-11". But as soon as I fire an API request, i get the error
"text": "Invalid value for name: \"dmoc23-11 \": leading or trailing whitespace is not allowed."
API request
curl -k -u admin:infoblox -H 'content-type:application/json' -X POST "https://172.20.165.192/wapi/v2.4/request" -d'[{"method": "STATE:ASSIGN","data":{"host_name":"dmoc23-11"}},{"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"}]'
My question is that If using a "-" symbol is not allowed, then how come i can use the GUI and enter the value using"-" symbol??? Or is it like my API request is incorrect?? Please suggest.
Re: Urgent: API to delete Host record
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2019 02:32 PM
Also, can I provide multiple search criteria along with host_name?
Re: Urgent: API to delete Host record
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2019 01:47 AM
The "-" is not the problem, but it looks like you are generating a trailing space after the hostname (dmoc23-11). From where were you running the curl command? Please check if it was run exactly like you pasted it above. Thanks.
Escalations Engineer EMEA
Re: Urgent: API to delete Host record
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2019 08:54 AM
Thanks for your input. Can I provide multiple parameter in my search along with host_name?
Re: Urgent: API to delete Host record
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2019 01:17 AM
Yes, you can. Something like this:
/wapi/v2.8/record:host?name~=test&mac=aa:aa:aa:aa:aa:aa
would search for all host records with test in the name and a certain mac address.
Escalations Engineer EMEA
Re: Urgent: API to delete Host record
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2019 02:38 AM
Hi,
There is a trailing space while passing your parameters in your curl command:
curl -k -u admin:infoblox -H 'content-type:application/json' -X POST "https://172.20.165.192/wapi/v2.4/request" -d'[{"method": "STATE:ASSIGN","data":{"host_name":"dmoc23-11"}},{"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"}]'
Yes, you can pass multiple query parameters like below:
curl -k -u admin:infoblox -H 'content-type:application/json' -X POST "https://172.20.165.192/wapi/v2.4/request" -d'[{"method": "STATE:ASSIGN","data":{"host_name":"dmoc23-11"}},{"method":"GET","object": "record:host","data":{"name":"##STATE:host_name:##","view":"default"},"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: Urgent: API to delete Host record
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
![](/skins/images/11FB49C344BC24C21F8BD3F62E11C3C6/responsive_peak/images/icon_anonymous_profile.png)
10-19-2019 04:09 PM - edited 10-19-2019 04:14 PM
Thanks for your input.
__________________________________________
Re: Urgent: API to delete Host record
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2019 01:30 PM - edited 11-13-2019 01:32 PM
okay. With respect to passing multiple parameters, if i want to add an extensible attribute as a serach parameter, how I do that.
For example if have an extensible attribute called ICN Device name. How and where should I put the parameters in API request below ??
curl -k -u admin:infoblox -H 'content-type:application/json' -X POST "https://132.10.155.172/wapi/v2.4/request" -d'[{"method": "STATE:ASSIGN","data":{"host_name":"testname"}},{"method":"GET","object": "record:host","data":{"name":"##STATE:host_name:##","view":"default.AI Automation","ICN Device Name":"ICN_Kukreti"},"assign_state": {"host_ref": "_ref"},"enable_substitution": true,"discard": true},{"method": "DELETE", "object": "##STATE:host_ref:##","enable_substitution": true,"discard": true},{"method":"STATEISPLAY"}]'