Reply

Unable to create a host record via WAPI (1.7.1)

astywryn
Techie
Posts: 3
3936     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.

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

[ Edited ]
Ingmar Community Manager
Community Manager
Posts: 47
3936     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)

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

astywryn
Techie
Posts: 3
3936     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)

astywryn
Techie
Posts: 3
3936     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
Showing results for 
Search instead for 
Do you mean 

Recommended for You