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.

Procedure
  1. Log into the switch from the ArubaOS-CX REST API Reference:
    1. Use a supported browser to access the switch at: https://<IP-ADDR>/api/

      <IP-ADDR> is the IP address or hostname of your switch.

    2. Expand the Login resource by clicking the resource name, /login, or by clicking Expand Operations.
    3. Enter your user name in the value of the username parameter.
    4. Enter your password in the value of the password parameter.
    5. Click Submit.
  2. 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:

    Subsystem resources and methods listed in REST API Reference
  3. Click the endpoint in the GET method to expand the collection.
    Subsystem GET method displayed in REST API Reference
  4. Navigate to the Parameters section and select the attribute or attributes you want to display.
    GET parameters listed in REST API Reference

    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.

  5. 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.

    GET method in REST API Reference showing curl and URL examples

  6. Construct the monitor URI from the Request URL and the Response Body (if needed).
    1. Copy and paste the Request URL into your script.
    2. 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
    3. 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.

      Response body in REST API Reference showing CPU resource

      The resulting example URI to monitoring CPU utilization is the following:

      /rest/v1/system/subsystems?attributes=resource_utilization.cpu

    4. 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.