Constructing a URI using the ArubaOS-CX REST API Reference
To construct the URI of a resource to monitor, you can use the GET method in the ArubaOS-CX REST API Reference to generate most of the URI. However, to do the following, you must edit the URL you copy and paste.
Use the dot notation to specify a component of an attribute.
Use a filter to specify an attribute name and value pair.
-
Log into the switch from the
ArubaOS-CX REST API Reference:
- Use a supported browser to access the switch at:
https://<IP-ADDR>/api/
<IP-ADDR>
is the IP address or hostname of your switch. - Expand the
Login resource by clicking the resource name,
/login
, or by clicking Expand Operations. - Enter your user name in the value of the username parameter.
- Enter your password in the value of the password parameter.
- Click Submit.
- Use a supported browser to access the switch at:
-
To expand the possible endpoints of a resource, click the resource name.
For example, CPU utilization is a kind of resource utilization, which is part of the subsystems resource collection:
- Click the endpoint in the GET method to expand the collection.
-
Navigate to the
Parameters section and select the attribute or attributes you want to display.
You can select multiple attributes:
To select a range of attributes, click the first attribute, then press Shift, and then click the last attribute in the range you want to select.
To select attributes that are not adjacent in the list, press Ctrl, then click each attribute you want to select.
-
Click
Submit.
The displayed information expands to show the curl command equivalent, the request URL, and the response body.
In the following example, the IP address of the switch is hidden by the gray box, and the response body is not shown.
-
Construct the monitor URI from the
Request URL and the
Response Body (if needed).
- Copy and paste the Request URL into your script.
- Remove the server information and any other information you specify elsewhere (such as the REST API version).
For example, the resulting URI is:
/rest/v1/system/subsystems?attributes=resource_utilization
- If you are specifying subcomponent of the attribute, view the
Response Body and record the exact name of the attribute component to add to the query portion of the URI.
For URIs specifying monitors only, you can specify components within attributes by using a "dot" notation after the attribute name.
For example, In the Response Body, the CPU utilization is part of the
resource_utilization
resource. You can specify that only the CPU resources be monitored by adding.cpu
after the attribute name. For example:resource_utilization.cpu
.The resulting example URI to monitoring CPU utilization is the following:
/rest/v1/system/subsystems?attributes=resource_utilization.cpu
- If you want to use the filter to specify both an attribute and a value, you must edit the URI to use the
filter
keyword and specify the attribute name and the attribute value.