Subnet API

About

API version:

The Subnet API allows you to save subnets and manage your saved subnets. Available actions:

Usage

List Subnets

Send a GET request to /api/account/subnet to retrieve a list of all your saved subnets.

Send a GET request to /api/account/subnet/:id to retrieve a single subnet with a known ID.

Results
Name Type Description
status string The status of the request.
'OK' is a good request.
'INVALID_REQUEST' means the authorization header is missing. See Authorization API.
'INVALID_GRANT' means the given access token is expired or invalid.
'SYSTEM_ERROR' means a system error occurred. Try the request again.
'NO_MATCHES' means no matching subnets were found. You may have no saved subnets.
subnets JSON array An array containing details of all of your saved subnets.

Example - cURL:

Example - PowerShell:

Save a Subnet

Send a POST request to /api/account/subnet to save a subnet.

The 'Content-Type' header must be set to 'application/json'.

The raw body of the request should include the attributes for the subnet. An example is shown below:

Note that if you provide an address within a subnet that is not the network address, the API will convert it to the appropriate network address.

Results
Name Type Description
status string The status of the request.
'OK' is a good request.
'INVALID_REQUEST' means the authorization header is missing. See Authorization API.
'INVALID_GRANT' means the given access token is expired or invalid.
'SYSTEM_ERROR' means a system error occurred. Try the request again.
'MISSING_HEADER' means a required header is missing.
'MISSING_VALUES' means you are missing one of the required parameters in the raw body.
'NETWORK_ADDRESS_INVALID' means the supplied network address is incorrectly formatted or otherwise invalid.
'UPDATE_FAILED' means there was a system error and the subnet could not be saved. Try the request again.
'DUPLICATE_ENTRY' means the subnet you are attempting to save is already saved to your account.
subnet JSON object The details of the subnet that was saved. Includes the subnet's unique ID.

Example - cURL:

Example - PowerShell:

Edit a Subnet

Send a PATCH request to /api/account/subnet/:id to edit a subnet.

The 'Content-Type' header must be set to 'application/json'.

The raw body of the request should include the relevant attributes for the subnet. An example is shown below:

Note that if you provide an address within a subnet that is not the network address, the API will convert it to the appropriate network address.

Results
Name Type Description
status string The status of the request.
'OK' is a good request.
'INVALID_REQUEST' means the authorization header is missing. See Authorization API.
'INVALID_GRANT' means the given access token is expired or invalid.
'SYSTEM_ERROR' means a system error occurred. Try the request again.
'MISSING_HEADER' means a required header is missing.
'MISSING_VALUES' means you are missing one of the required parameters in the raw body.
'NETWORK_ADDRESS_INVALID' means the supplied network address is incorrectly formatted or otherwise invalid.
'UPDATE_FAILED' means there was a system error and the subnet could not be saved. Try the request again.
subnet JSON object The details of the subnet after the update.

Example - cURL:

Example - PowerShell:

Delete a Subnet

Send a DELETE request to /api/account/subnet/:id to delete a subnet.

Results
Name Type Description
status string The status of the request.
'OK' is a good request.
'INVALID_REQUEST' means the authorization header is missing. See Authorization API.
'INVALID_GRANT' means the given access token is expired or invalid.
'SYSTEM_ERROR' means a system error occurred. Try the request again.
'DELETE_FAILED' means am error occurred, preventing the delete. Check the query parameters and try the request again.
'NOT_FOUND' means the subnet could not be deleted because a subnet with the supplied ID was not found.

Example - cURL:

Example - PowerShell:

Sample Output
GET
https://networkcalc.com/api/account/subnet