Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

Security

Reply
Highlighted

Unable to create a host record via WAPI (1.7.1)

Techie
Posts: 3
5162     0

Hi,

 

I'm trying to create a new host record.  I get the following error:

 

"Error": "AdmConProtoError: JSON Decoding: No JSON object could be decoded",
"code": "Client.Ibap.Proto.JSONDecoding",
"text": "JSON Decoding: No JSON object could be decoded"

 

The method is a POST call.  The content type is application/json.

 

URL: https://1.1.1.7/wapi/v1.7.1/record:host

 

Data field part of the request:

 

'{"name":"wtfsvr","ipv4addrs":[{"ipv4addr":"10.1.1.166","mac":"00:00:00:00:00:00"}]}'

 

Any help is greatly appreciated.

Highlighted

Re: Unable to create a host record via WAPI (1.7.1)

[ Edited ]
Community Manager
Community Manager
Posts: 66
5163     0

Can you share how you are useing the API call.

 

I just used the following and it went through:

curl --request POST  --url https://testserver/wapi/v2.5/record:host  --header 'authorization: Basic <authstringgoeshere.'
  --header 'content-type: application/json'   --data '{"name": "wtfsvr.example.com","ipv4addrs": [{"ipv4addr": "10.1.1.166","mac": "00:00:00:00:00:00"}]}'

 

Note that a Host object still needs a zone to be parented in (so the standalone "wtfsvr" record will not work)

Highlighted

Re: Unable to create a host record via WAPI (1.7.1)

Techie
Posts: 3
5163     0

Hi,

 

I was using an Ansible URI call.  It seems that its either the "k1" or the "-X" that is causing the failed request.  Using a straight curl with a FQDN worked fine.

 

curl -k1 -u usernameSmiley Tongueassword -H Content-Type:application/json -X POST https://1.1.1.1/wapi/v1.7.1/record:host -d '{"ipv4addrs":[{"ipv4addr":"1.10.13.60"}],"name":"wtfsvr.example.com"

 

I have one more question... Is there a way I can add a description directly into the POST statement?  I tried adding a "device_descritption" after the name, but that failed.  I see that you can search for that field, but not sure if it can be added while adding a new host record.

 

Thanks!

Highlighted

Re: Unable to create a host record via WAPI (1.7.1)

Techie
Posts: 3
5163     0
Figured out the description too. For a host record, the description is really a "comment". Added "comment":"This is a test server!" to the end of the data section, and it worked like a charm.

Thanks
Highlighted

Re: Unable to create a host record via WAPI (1.7.1)

Techie
Posts: 2
5163     0

Hi 

 

I tried do perform the same action and 

Highlighted

Re: Unable to create a host record via WAPI (1.7.1)

Techie
Posts: 2
5163     0

Hi 

 

I tried to perform the same action but I cannot due to following messsage below so anyone has idea about the issue.

 

curl -k1 -u admin:infoblox -H "Content-Type: application/json" -X POST https://dnslab/wapi/v2.9.7/record:host -d '{"ipv4addrs":[{"ipv4addr":"10.222.0.12"}],"name":"teste4.test.net"}'
{ "Error": "AdmConProtoError: JSON Decoding: No JSON object could be decoded",
"code": "Client.Ibap.Proto.JSONDecoding",
"text": "JSON Decoding: No JSON object could be decoded"

 

Thanks

Roberto

Highlighted

Re: Unable to create a host record via WAPI (1.7.1)

[ Edited ]
Techie
Posts: 21
5163     0

The Infoblox WAPI is an interface based on REST (REpresentational State Transfer), also called a RESTful web API. It uses HTTP methods for operations and supports input and output in JSON and XML.

 

snaptube vidmate

Showing results for 
Search instead for 
Do you mean 

Recommended for You