Reply

API call to find the parent container for a network

New Member
Posts: 1
2649     1

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?

Re: API call to find the parent container for a network

Superuser
Posts: 38
2649     1

Hi JMZ991,

 

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='
Shukran

Re: API call to find the parent container for a network

New Member
Posts: 6
2650     1

Hi Everyone, 

 

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. 

 

Thanks, Dan

Re: API call to find the parent container for a network

Superuser
Posts: 65
2650     1

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"
Showing results for 
Search instead for 
Did you mean: 

Recommended for You