Cisco Prime Infrastructure API
Prime Infrastructure API Documentation

Using Sorting

Sorting lets you control the order in which resources are returned. They can be sorted in Ascending or Descending order based on multiple sort fields. Check the documentation for each request type to see if it supports Sorting.

For example, to sort a list of Devices by their latest collection times, you may use the following URL

	../webacs/api/v4/data/Devices?.sort=collectionTime
				

To sort on a nested parameter value, you can use a "dotted" notation to each attribute name. For example, to sort InventoryDetails by device names, you may use the following URL:

	../webacs/api/v4/data/InventoryDetails?.full=true&.sort=summary.deviceName
				

Note that sorting on a nested collection attributes and collections of primitives is not supported.

Ascending vs. Descending

Ascending or Descending order is controlled by adding a "+" or "-" in front of the attribute name.

	../webacs/api/v4/data/Devices?.sort=+collectionTime
				

... sorts on Ascending collectionTime, whereas

	../webacs/api/v4/data/Devices?.sort=-collectionTime
				

... sorts on Descending collectionTime.

Sorting on Multiple Attributes

Sorting can be controlled over multiple attributes by specifying a comma-separated list of attribute names with their respective order. For example:

	../webacs/api/v4/data/Devices?.sort=+collectionTime,-softwareVersion
				

... sorts by ascending collectionTime first and descending softwareVersion.