Cisco Prime Infrastructure API
Prime Infrastructure API Documentation

# Frequently Asked Questions

Additional answers may be found in the things to know section about the Prime Infrastructure API, and in the tutorials.

- 1. What is the syntax for requests to the Prime Infrastructure API?
- 2. XML or JSON in the response?

#### 1. What is the syntax for requests to the Prime Infrastructure API?

The general structure of a request to the Prime Infrastructure API is as follows:

      ../webacs/api/v1/data/{RESOURCE-NAME}

This will list all instances of that resource. For example, ../webacs/api/v1/data/Devices will return a list of all Device instances in the system.

      ../webacs/api/v1/data/{RESOURCE-NAME}/{RESOURCE-ID}

This will return the unique instance identified by the given {RESOURCE-ID}. For example, ../webacs/api/v1/data/Devices/12412764 returns the "12412764" device.

Qualifiers may be added to use filtering, paging and sorting following this format:

      ../webacs/api/v1/data/{RESOURCE-NAME}?{operator-expression1}&{operator-expression2}...&{operator-expressionN}

Each operator expression may be a filtering criteria such as ipAddress="192.168.1.3", or a paging directive, or a sorting directive, such as .sort=-collectionTime.

Optionally, the .full=true qualifier may be added to return the full instance.

Additional RESTful services are available through the following URL pattern:

      ../webacs/api/op/{service-domain}/{service-resource}

For example, ../webacs/api/op/reportservice/templates provides a way to list all report templates that may be used to create reports.

#### 2. XML or JSON in the response?

The response to a request to the Prime Infrastructure API may be returned in one of two standard formats: XML, JSON. The format of the response may be specified in one of two ways:

- By using adding a ".json" or ".xml" suffix to the URL used for the query. For example:

        ../webacs/api/v1/data/Devices?ipAddress="192.168.8.9".json

  returns a response in JSON format, whereas

        ../webacs/api/v1/data/Devices?ipAddress="192.168.8.9".xml

  returns a response in XML format.
- By specifying the expected format in the request "Accept" header:

        Accept: application/json

  returns a response in JSON format, whereas

        Accept: text/xml

  returns a response in XML format.

By default, when nothing is specified, the response format is set to be XML.

- ← Tutorials
- FAQ
- Home →