THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

API & Integration, DevOps,NetOps,SecOps

Reply

Urgent: API to delete Host record

Authority
Posts: 29
7412     0

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":"STATESmiley Very HappyISPLAY"}]'

 

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

Authority
Posts: 29
7412     0

Also, can I provide multiple search criteria along with host_name?

Re: Urgent: API to delete Host record

Authority
Posts: 14
7412     0

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.

Jelle
Escalations Engineer EMEA

Re: Urgent: API to delete Host record

Authority
Posts: 29
7413     0

Thanks for your input. Can I provide multiple parameter in my search along with host_name?

Re: Urgent: API to delete Host record

Authority
Posts: 14
7413     0

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.

Jelle
Escalations Engineer EMEA

Re: Urgent: API to delete Host record

Adviser
Posts: 181
7413     0

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 ]
Anonymous
Not applicable
Posts: 20
7413     0

Thanks for your input. 

 

 

__________________________________________

Sarkari Result Pnr Status 192.168.1.1

Re: Urgent: API to delete Host record

[ Edited ]
Authority
Posts: 29
7413     0

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":"STATESmiley Very HappyISPLAY"}]'

Showing results for 
Search instead for 
Did you mean: 

Recommended for You