03-16-2022 03:13 AM
I was looking for an API call to get the parent container details for a existing network in DHCP/IPAM.
To elaborate more, say I have a network named 10.41.1.0/24. I need to get the parent container for the same (eg: 10.41.0.0/16) by querying with the network CIDR.
Is it possible to get this?
03-18-2022 02:54 AM
You can fetch the parent container details by appending "_return_fields=network_container" to your query.
Below is an sample curl command for your given example
curl --location --request GET 'https://<grid-master>/wapi/v2.12/network?network~=10.41.1.0/24&_return_fields%2b=network_container' \ --header 'Authorization: Basic YWRtaW46aW5mb2Jsb3g='
11-02-2022 06:05 AM
In the same concept, what is the API to get only the network container with the extensible attributes? A container without any network.
I can do a GET in a network container if I have a network that belongs to the same container. But I cannot do the GET in the container itself.
11-02-2022 08:35 AM
To find a network container, you specify the object type as networkcontainer instead of network. For example, the following curl command will return network container(s) with EA of Site equal to HQ.
curl -k -u <username>:<password> -X GET "https://<grid-master>/wapi/v2.12/networkcontainer?_return_fields%2B=extattrs&*Site%3A=HQ&_return_as_object=1"