URI path, including path parameters
The path is the part of the URI starting with the server URL and ending with the resource ID. In URIs that have a query component, the path is everything before the question mark (?
) character. The path is a hierarchy. The forward slash (/
) character indicates the hierarchical relationship between resources.
Because the forward slash character has special meaning, forward slash characters that are part of the URL path must be percent-encoded, with the code
%2F
representing the forward slash. For example, the following URI represents the resource utilization for the management module in slot 1/5:
https://192.0.2.5/rest/v1/system/subsystems/management_module/1%2F5?attributes=resource_utilization
URI prefix
The URI prefix is the system URL and REST API version information. This information is specific to a particular switch and REST API version and is the same for every REST API request to that switch.
Script writers often create a variable for the URI prefix. Using a variable enables the writer to update a script or use the same script logic for a different switch by updating the value of the URI prefix variable.
The URI prefix contains the following:
- Server URL
The web server address of the switch.
Examples:
https://192.0.2.5
https://10.17.0.1
https://myswitch.mycompany.com
If Virtual Switching Extension (VSX) is enabled, you can access most resources of the peer switch from this switch by inserting
/vsx-peer
in the URI path between the server URL and/rest
.For example:
GET https://192.0.2.5/vsx-peer/rest/v1/system/vsx?attributes=oper_status
- REST API and version identifier
For example:
/rest/v1
Path parameters
A path parameter is a part of the URI path that can vary. Typically path parameters indicate a specific instance of a resource in a collection, such as a specific VLAN in the
vlans
collection. The path can contain several path parameters. Path parameters are indicated by braces
{}
.
For example, the ArubaOS-CX REST API Reference displays the resource for specific VLAN as the following:
/system/vlans/{id}
When you send a request for VLAN 10, the URI you provide must substitute the VLAN ID,
10
, for the
{id}
query parameter. For example:
/system/vlans/10
In the ArubaOS-CX REST API Reference, you enter the value of the path parameter in the Value field of the id parameter.