Reply
Highlighted
Accepted Solution

How to filter with WAPI for "struct" datatypes

chaichhorn
Techie
Posts: 2
1044     0

I want to get a list of all fixedaddress objects, filtered by the ms_server attribute. The API documentation sais, that this attribute is searchable but as "struct" datatype.

I´m not able to execute this with a result:

 

https://ipamipaddress/wapi/v2.7.1/fixedaddress?_max_results=1&ms_server={'_struct': 'msdhcpserver', 'ipv4addr': 'XXXXX'}

returns

AdmConProtoError: Structure expected in ms_server ({'_struct': 'msdhcpserver', 'ipv4addr....

 

Any idea how to build the GET request (GET´s dont allow a body element).

 

Thanks and regards,

Christoph

Re: How to filter with WAPI for "struct" datatypes

Authority
Posts: 19
1045     0

Hi Christoph,

 

While GET requests are not typically made with a body, it does permit a body that it can use. 

 

I was able to get the desired output with the below WAPI (using curl):

 

curl -k -u admin:infoblox -X GET https://grid.master/wapi/v2.7/fixedaddress -d '{"ms_server":{"_struct": "msdhcpserver","ipv4addr": "10.10.10.10"}}' -H 'content-type: application/json'

 

Hope this helps.

 

Thanks

Re: How to filter with WAPI for "struct" datatypes

chaichhorn
Techie
Posts: 2
1045     0

Hi,

thanks for your information. As you write, GET doesn´t allow a body. With curl you can append a body to this request, but this is not allowed in the standard and many other API tools sadly don´t allow that type of malformed GET request.

 

I found a solution with using a other Method that allows a body (PUT, POST) and tell the WAPI that this request is a GET request by attaching the _method=GET string.

 

curl -k -u admin:infoblox -X PUT https://grid.master/wapi/v2.7/fixedaddress?_method=GET -d '{"ms_server":{"_struct": "msdhcpserver","ipv4addr": "10.10.10.10"}}' -H 'content-type: application/json'

 

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You