Reply
Highlighted
Accepted Solution

WAPI - Nested return fields not working

Svetoslav
Techie
Posts: 4
1012     0

Hello,

 

This request:

 

GET https://infoblox/wapi/v2.9/record:host?_return_fields=ipv4addrs.network&ipv4addr=1.0.0.1

is supposed to return a record:host object with "ipv4addrs" field, which should contain the "network" field. Something like this:

[
  {
    "_ref": "record:host/ZG5zLmhHBkjnvcsddsfQk...",
    "ipv4addrs": [
       {
         "_ref": "record:host_ipv4addr/ZGKJosKadLmhvc3Rf...",

         "network": "1.0.0.0"
       }
    ]
  }
]

 

In the wapi documentation this is refered as "nested return fields":
https://ipam.illinois.edu/wapidoc/index.html#subreturnfields

 

The problem is that I never get the network. I tried with other objects - as in the docs example - "ipv4addrs.bootserver", but didn't get the nested field. No error, just no "network" or "bootserver" field, just the default one - "_ref".

 

Is there any configuration on the grid restricting the nested fields?

Are you able to use a nested return field with success?

 

 

Re: WAPI - Nested return fields not working

Adviser
Posts: 93
1013     0

Yes it does work however the network has to be defined in IPAM for it to return a value.

 

For example this works because the internal network exists.

 

 

$ curl -k -u admin:infoblox -X GET 'https://192.168.1.6/wapi/v2.9/record:host?_return_fields%2b=ipv4addrs,ipv4addrs.network&nae=printer.example.org'
[
    {
        "_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm5ldHdvcmsucmljaGFyZC5wcmludGVy:printer.example.org/Internal", 
        "ipv4addrs": [
            {
                "_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQubmV0d29yay5yaWNoYXJkLnByaW50ZXIuMTAuOS4xNi41Lg:192.168.1.5/printer.example.org/Internal", 
                "configure_for_dhcp": true, 
                "host": "printer.example.org", 
                "ipv4addr": "192.168.1.5", 
                "mac": "00:0e:7f:12:34:56", 
                "network": "192.168.1.0/24"
            }
        ], 
        "name": "printer.example.org", 
        "view": "Internal"
    }
]

 

But this one does not return a network, because the public parent network is not defined in IPAM.

 

 

 

curl -k -u admin:infoblox -X GET 'https://192.168.1.6/wapi/v2.9/record:host?_return_fields%2b=ipv4addrs,ipv4addrs.network&name=www.example.org'
[
    {
        "_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0Lm5ldHdvcmsucmljaGFyZC5tYXR0:www.example.org/Internal", 
        "ipv4addrs": [
            {
                "_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQubmV0d29yay5yaWNoYXJkLm1hdHQuNzMuMjMwLjE4MS40My4:73.230.12.34/www.example.org/Internal", 
                "configure_for_dhcp": false, 
                "host": "www.example.org", 
                "ipv4addr": "73.230.12.34"
            }
        ], 
        "name": "www.example.org", 
        "view": "Internal"
    }
]

 

 

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You