Sorting resource lists

Content Platform Tenant Management Help

Version
9.7.x
File Size
4269 KB
Audience
anonymous
Part Number
MK-95HCPH002-19

You can retrieve a sorted list of items of a particular resource type by specifying the property you want to sort by and the sort order in the GET request. You can sort namespaces by name or by hard quota. You can sort user accounts by username.

To specify a sort property and sort order, you use these query parameters in the GET request:

sortType=property-name
specifies the property you want to sort by. Valid values are:
  • For the namespaces and dataAccessPermissions resources, name and hardQuota
  • For the userAccounts resource, username
This parameter is optional. For the namespaces and dataAccessPermissions resources, the default is name.
sortOrder=(ascending|descending)
specifies the order in which to sort the listed items.
This parameter is optional. The default is ascending.

For example, this GET request sorts the list of in descending order by hard quota:

curl -k -i -H "Accept: application/xml"
    -H "Authorization: HCP YWxscm9sZXM=:04EC9F614D89FF5C7126D32ACB448382"    "https://admin.hcp.example.com:9090/mapi/tenants/finance/namespaces?
         sortType=hardQuota&sortOrder=descending&prettyprint"

These considerations apply to sorting resource lists:

  • The sortType and sortOrder parameters are valid only with the namespaces, userAccounts, and dataAccessPermissions resources.
  • You can page, sort, and filter resource lists in the same request.