Filtering 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 subset of items of a particular resource type by specifying a filter in the GET request. To apply a filter, you specify the property you want to filter by and the text string to use as the filter. The filtered list includes only those items for which the value of the specified property begins with or is the same as the specified text string.

You can filter namespaces by name or by tag. You can filter user accounts by username.

To specify a filter, you use these query parameters in the GET request:

filterType=property-name
specifies the property by which to filter the resource list. Valid values for property-name are:
  • For the namespaces and dataAccessPermissions resources, name and tag
  • For the userAccounts resource, username
The filterType parameter is optional. For the namespaces and dataAccessPermissions resources, the default is name.
filterString=text-string
specifies the text string to use as the filter. This string is not case sensitive.
Text strings can be at most 64 characters long and can contain any valid UTF-8 characters except commas (,). White space is allowed and must be percent encoded.

For example, this GET request filters the list of namespaces for the Finance tenant by names beginning with the string accounts:

curl -k -i -H "Accept: application/xml"
    -H "Authorization: HCP bGdyZWVu:a3b9c163f6c520407ff34cfdb83ca5c6"
    "https://finance.hcp.example.com:9090/mapi/tenants/finance/namespaces
        ?filterType=name&filterString=accounts&prettyprint"

These considerations apply to filtering resource lists:

  • The filterType and filterString parameters are valid only with the namespaces, userAccounts, and dataAccessPermissions resources.
  • If a GET request includes the filterType parameter but does not include the filterString parameter, HCP returns the complete list of items of the applicable type.
  • You can page, sort, and filter resource lists in the same request.