Learn How We Can Help You Keep Teleworkers Protected During the COVID-19 Crisis

API Examples

Reply
Highlighted

host query and subnet as part of response

Techie
Posts: 9
330     0

Hello.

 

I am doing a simple query to get a host record and it works fine. Here's what body looks like:

 

[{
"method": "GET",
"object": "record:host",
"data": {"name": "abc.com",
"network_view": "default"},
"args": { }
}]

 

and it responds me with answer:

 

{
            "_ref": "record:host/RECORD",
            "ipv6addrs": [
                {
                    "_ref": "record:host_ipv6addr/RECORD",
                    "configure_for_dhcp": false,
                    "host": "abc.com",
                    "ipv6addr": "3400:7211:4234::abf1"
                }
            ],
            "name": "abc.com",
            "view": "  "
        }
 
but if you think it from router's prospective; when an interface is configured with subnet so if I'm configuring above to the router then i need to configure something like this: 3400:7211:4234::abf1/122 (/122 for example). We use Infoblox to get host IP and then configure it based on the response to the get query but we don't get subnet as part of query.

Is there a way we can get 3400:7211:4234::abf1/122 as a resonse to a get query?
 
Highlighted

Re: host query and subnet as part of response

[ Edited ]
Community Manager
Community Manager
Posts: 152
330     0

I think the best you could do is get the address, and separately get the network in CIDR format.  But only if DHCP is checked on that host address.  If DHCP is not checked, the address is not linked to a DHCP network.

 

 

 

[{
"method": "GET",
"object": "record:host",
"data": {"name": "abc.com",
"network_view": "default"},
"args": {
"_return_fields+":"ipv6addrs.ipv6addr,ipv6addrs.network" }
}]
'

which returns something like this:

 

[
    [
        {
            "_ref": "record:host/RECORD:abc.com/default",
            "ipv6addrs": [
                {
                    "_ref": "record:host_ipv6addr/RECORDADDR/abc.com/default",
                    "configure_for_dhcp": true,
                    "duid": "ab:cd",
                    "host": "abc.com",
                    "ipv6addr": "2603:abcd:1234:1002::9",
                    "network": "2603:abcd:1234:1002::/64"
                }
            ],
            "name": "abc.com",
            "view": "default"
        }
    ]
]
Showing results for 
Search instead for 
Do you mean 

Recommended for You