Reply

Create Host Record.. record:host with Powershell against WAPI V2.0

Not applicable
Posts: 1
6011     0
Basically I canoot get this to work in PS or in Pearl which makes me wonder if the syntax has changed A Get command: https://10.10.61.20/wapi/v2.0/record:host the Get Result: bullet3falserecord:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQubm9uX0ROU19ob3N0X3Jvb3QuMC4xNDMxMDA2MTg0MjE4LmJ1bGxldDMuMTAuMTAuNjEuMzAu:10.10.61.30/bullet3/%2000:00:00:00:00:0010.10.61.30bullet3record:host/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTQzMTAwNjE4NDIxOC5idWxsZXQz:bullet3/%20 The above is correct theere is only one host configured on the system... the problem arises when I try to create a host A POST command: https://10.10.61.20/wapi/v2.0/record:host?{{'ipv4addrs':%20[{'ipv4addr':%20'10.10.61.31'}],%20'name'... The Post Result: { "Error": "AdmConProtoError: Unknown argument/field: '{{'ipv4addrs': [{'ipv4addr': '10.10.61.31'}], 'name': 'hostname.localdomain'}'", "code": "Client.Ibap.Proto", "text": "Unknown argument/field: '{{'ipv4addrs': [{'ipv4addr': '10.10.61.31'}], 'name': 'hostname.localdomain'}'" } In Pearl: curl -k -i -u "admin:infoblox" -X POST https://10.10.61.20/wapi/v2.0/record:host -d {"ipv4addrs":[{"ipv4addr":"10.10.61.31"}],"name":"host.localdomain"} HTTP/1.1 400 Bad Request Date: Thu, 07 May 2015 16:41:35 GMT Cache-Control: no-cache, no-store Pragma: no-cache Content-Type: application/json set-cookie: ibapauth="ip=10.10.22.70,client=API,group=admin-group,ctime=1431016895,timeout=600,mtime=1431016895,su=1,auth=LOCAL,user=admin,rDjEfnaSExUd3CNQQ8dyIEQnQ+Nl40RTTKM"; httponly; Path=/; secure Connection: close Transfer-Encoding: chunked { "Error": "AdmConProtoError: Unknown argument/field: 'ipv4addrs:[{ipv4addr:10.10.61.31}]'", "code": "Client.Ibap.Proto", "text": "Unknown argument/field: 'ipv4addrs:[{ipv4addr:10.10.61.31}]'" Any Help at All would be appreciated, this API isn't one of the most intuatve that I'v worked with. Thanks. Scott

Data fields on POST need to be in JSON format

Adviser
Posts: 33
6012     0

I'm pretty sure that your problem is that you need to specify that the data submitted as part of the POST request is in JSON format. For example, if I do the following Curl command then it works as expected and the host record is successfully created:

curl --tlsv1 --user 'admin:infoblox' --header 'Content-Type: application/json' --data '{"name": "foobar.example.com", "ipv4addrs": [{"ipv4addr": "192.168.1.15"}]}' 'https://gm.example.com/wapi/v2.0/record:host'

However if I omit the --header option, as in the following command:

curl --tlsv1 --user 'admin:infoblox' --data '{"name": "foobar.example.com", "ipv4addrs": [{"ipv4addr": "192.168.1.16"}]}' 'https://gm.example.com/wapi/v2.0/record:host'

then I get the exact same error you're seeing.

Re: Data fields on POST need to be in JSON format

New Member
Posts: 1
6012     0

I have similar error

 

{ "Error": "AdmConProtoError: Unknown argument/field: 'ipv4addrs'", 
"code": "Client.Ibap.Proto",
"text": "Unknown argument/field: 'ipv4addrs'"
}

when doing PUT request  https://[GRID]//wapi/v2.3/record:a/_ref (reference here) and neither { [ { "ipv4addr":"1.1.1.31" } ] } nor { "name":"webt.xxx.com","ipv4addrs":[ { "ipv4addr":"1.1.1.31" } ] } help. 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You