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 & Integration, DevOps,NetOps,SecOps

Reply

Urgent: API to delete Host record

Authority
Posts: 29
4752     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
4753     0

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

Re: Urgent: API to delete Host record

Authority
Posts: 14
4753     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
4753     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
4753     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: 179
4753     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: 28
4753     0

Thanks for your input. 

 

 

__________________________________________

Sarkari Result Pnr Status 192.168.1.1

Re: Urgent: API to delete Host record

[ Edited ]
Authority
Posts: 29
4753     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

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin