cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3165
Views
1
Helpful
0
Comments
sramiya
Level 1
Level 1
  1. What is the syntax for requests to the Prime Infrastructure Request API?
  2. How do you define the response format as XML or JSON?
  3. Is filtering, paging and sorting of results available for all resources?
  4. How do I reduce API latency and increase throughput?
  5. Is there a sandbox available for Prime Infrastructure in DevNet?
  6. Is the Prime Infrastructure REST API supported by TAC?
  7. What is the link for Prime Infrastructure Trial download?
  8. What is the link for the Prime Infrastructure REST API documentation?
  9. Is there a learning lab for Prime Infrastructure REST API
  10. What is the Git repository URL for basic REST API code samples?

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 Device instances(100 by default) 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: How do you define the response format as XML or JSON ?

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

  • By adding ".json" or ".xml" to the URL, at the end of the path but before the query string. For example:

  ../webacs/api/v1/data/Devices.json?ipAddress="192.168.8.9” returns a response in JSON format, whereas

  ../webacs/api/v1/data/Devices.xml?ipAddress="192.168.8.9” 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.

3: Is filtering, paging and sorting of results available in all resources?

No. One must verify the documentation for a given resource and operation before sending filtering, paging and sorting params in the URL.

For example, the below resource GET operation does not support filtering, sorting and paging as per the documentation.

https://developer.cisco.com/media/prime-infrastructure-api-reference-v3-0/192.168.115.187/webacs/api/v1/op/groups/sites-…

4: How do I reduce API latency and increase throughput?

If you would like to cut down the latency of API requests, or improve throughput, you can try some of the following tips:

  • For queries against resources that support paging, try using the ".nocount" parameter and set it to true. For example

  ../webacs/api/v1/data/Devices?.nocount=true

Doing so will remove the "count," "first," and "last" attributes from the API response. However, the API will require one less query against the underlying data source, yielding a lower latency.

  • Consider using Summary resources if they report all the information you need. API latency can be reduced by using resources that return more limited sets of information. For instance, if you wish to get the IP addresses of clients, then Client Summary will report the data you need faster than Client Details.
  • Use larger page sizes for resources that support paging. While it might seem counter-intuitive, most of the performance costs paid by the API are on a per-request basis, not a per-record basis. By increasing page sizes, you can reduce the overall number of requests and increase your overall throughput.

5: Is there a Sandbox available for Prime Infrastructure on DevNet?

At this time we don't have a Prime Infrastructure sandbox available.  However, Prime Infrastructure does come with an out-of-the-box evaluation license that you can use for API testing and development

6. Is the Prime Infrastructure  REST API supported by TAC?

When TAC is contacted regarding the Prime REST API, the customers will be directed to appropriate support forums. Here is the link for DevNet community forum Prime Infrastructure  Also , Prime Infrastructure REST API related queries can be sent to  ask-prime-infrastructure@cisco.com which is checked regularly by customer support engineers, product managers, and developers that work on Prime Infrastructure.

7: What is the link for Prime Infrastructure Trial download?

https://ciscosoftware.mediuscorp.com/market/networkers/listSubCat?TRGT=9&/nxt/rcrs/=1127

8: What is the link for the REST API Documentation?

https://developer.cisco.com/site/prime-infrastructure/

9: Is there a learning lab for Prime Infrastructure REST API?

If there is already Prime Infrastructure installed, then the below URL will provide guidance on basics of developing REST API

https://learninglabs.cisco.com/lab/pi-api-101-rest-basics/step/1

10: What is the Git repository URL for basic REST API code samples?

https://github.com/CiscoDevNet/coding-skills-sample-code

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links