Network Subnets API Code Samples

Selection of code samples that demonstrate the use of the Network Subnets API. Copy and edit these code samples to suit your needs.

When using the code samples, remember to replace:

  • {vanity_name} with your tenant name
  • {api_key} with your API key
  • {security_token} with a valid security token

These code samples may not include all available parameters and request body fields for each endpoint. For the endpoint's full request schema, see "Network Subnets" in API Reference.

Retrieve a list of API network subnets

Use this sample request to retrieve all the IP addresses that can call Visier APIs.

Copy
cURL sample request: Retrieve a list of all allowed IP addresses
curl -X GET --url 'https://{vanity_name}.api.visier.io/v1alpha/admin/api-network-subnets' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'

The response returns the IP addresses that are allowed to call Visier APIs.

Update API network subnets

Use this sample request to replace the existing list of allowed IP addresses with a new list of allowed IP addresses.

Copy
cURL sample request: Overwrite the existing list of IP addresses that can call Visier APIs with a new list
curl -X PUT --url 'https://{vanity_name}.api.visier/v1alpha/admin/api-network-subnets' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}'
-d '{
        "networkSubnetsForApi": ["1.2.3.0/24"],
        "confirmLockout": true
}'

The response returns the IP addresses that are allowed to call Visier APIs.

Add API network subnets

Use this sample request to add the specified IP addresses to the list of allowed IP addresses.

Copy
cURL sample request: Add the IP addresses to the list of allowed API network subnets
curl -X POST --url 'https://{vanity_name}.api.visier/v1alpha/admin/api-network-subnets' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
    "networkSubnetsForApi": ["1.2.3.0/24"],
    "confirmLockout": true
}'     

The response returns the IP addresses that are allowed to call Visier APIs.

Delete API network subnets

Use this sample request to remove the specified IP addresses from the list of allowed IP addresses. Users cannot call Visier APIs from the removed IP addresses.

Copy
cURL sample request: Remove the IP addresses from the list of allowed API network subnets
curl -X DELETE --url 'https://{vanity_name}.api.visier/v1alpha/admin/api-network-subnets' \
-H 'apikey:{api_key}' \
-H 'Cookie:VisierASIDToken={security_token}' \
-H 'Content-Type: application/json' \
-d '{
    "networkSubnetsForApi": ["1.2.3.0/24"],
    "confirmLockout": true
}'    

The response returns the IP addresses that are allowed to call Visier APIs.