Reply
Accepted Solution

WAPI - problem seeing comment field in IPv4 Reservation

msennott
Techie
Posts: 5
3153     0

I am trying to retrieve a DHCP reservation record (by IP) using Curl, but the one field I need to see - the comment - is always missing:

 

curl -k -u 'user:\password' -X GET 'https://infoblox.domain.com/wapi/v2.3.1/ipv4address?_return_fields%2B=extattrs&ip_address=10.160.192...'


[
    {
        "_ref": "ipv4address/Li5pcHY0X2FkZHJlc3MkMTAuMTYwLjE5Mi41MS8w:10.160.192.51",
        "extattrs": {},
        "ip_address": "10.160.192.51",
        "is_conflict": false,
        "mac_address": "",
        "names": [],
        "network": "10.160.192.0/24",
        "network_view": "default",
        "objects": [
            "fixedaddress/ZG5zLmZpeGVkX2FkZHJlc3MkMTAuMTYwLjE5Mi41MS4wLi4:10.160.192.51/default"
        ],
        "status": "USED",
        "types": [
            "RESERVATION"
        ],
        "usage": [
            "DHCP"
        ]
    }
]

 

I've tried specifying the extrattrs (see above) but no luck. I've also tried specifying the comment field (see below) but it returns an error:

 

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

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

 

Here is a screenshot from the GUI showing that the comment field contains the hostname I want. Don't ask me why the network guys did this - it is a legacy issue from when they imported all these records from a different IPAM.

 

https://s3-us-west-2.amazonaws.com/s3msennott/dhcp_question.jpg

 

Do I have to do a second search using one of the object refs being returned? If so, how would I do that?

Re: WAPI - problem seeing comment field in IPv4 Reservation

JMetzenthin
Techie
Posts: 13
3153     0

For fixedaddress calls you have to state you want comment returned and it is with a lower case format.

example

/wapi/v2.1/fixedaddress?_return_fields=name,comment,ipv4addr,discovered_data,extattrs

Fixedaddress also will show you entires that are reservations.

 

extensible attributes are the unique fields that have been added by the end user admins.  Referencing one of those you have to look for both the extattrs and the field name, example:

entry['extattrs']['SerialNumber']

Highlighted

Re: WAPI - problem seeing comment field in IPv4 Reservation

[ Edited ]
msennott
Techie
Posts: 5
3153     0

Thanks for the reply! Just for the other newbies out there, here is the text of the new search that works:

 

curl -k -u 'user:password' -X GET 'https://infoblox.domain.com/wapi/v2.3.1/fixedaddress?_return_fields=comment,ipv4addr&ipv4addr=10.160.192.51'
Showing results for 
Search instead for 
Do you mean 

Recommended for You