Paging through resource lists

Content Platform Tenant Management Help

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

You can limit the number of items HCP returns in response to an individual GET request by specifying an offset into the applicable list and a count of the items to return. By issuing multiple such requests, you can retrieve the entire list, one manageable number of items at a time. This is called paging.

To specify the offset and count, you use these query parameters in the GET request:

offset=offset
specifies the offset of the first item to include in the returned tenant or namespace list.
count=count
specifies the number of items to return.

These considerations apply to paging through resource lists:

  • The offset and count parameters are valid only with the namespaces, userAccounts, and dataAccessPermissions resources.
  • The first item in the complete list is at offset zero. So, for example, to retrieve the first five items, you would specify offset=0 and count=5. To retrieve the sixth through tenth items, you would specify offset=5 and count=5.
  • If you omit the offset parameter, the returned list starts with the item at offset zero.
  • If you specify an offset that is greater than or equal to the number of items in the complete list, no items are returned.
  • If you omit the count parameter, the returned list includes all items starting from the offset and continuing through the end of the complete list.
  • If you specify a count that is greater than the number of items remaining in the complete list after the offset, the returned list includes all items starting from the offset and continuing through the end of the complete list.
  • If an item is deleted while you are paging through the applicable list, the full list of items returned may be incomplete. For example, suppose a tenant has six namespaces (A, B, C, D, E, and F):
    1. You issue a GET request for the namespaces resource with these query parameters: offset=0&count=3

      HCP returns A, B, and C.

    2. Namespace B is deleted without your knowledge.

      The remaining namespaces are A, C, D, E, and F.

    3. You issue a second GET request for the namespaces resource with these query parameters: offset=3&count=3

      HCP returns E and F. It does not return D because D is now at offset two.

  • You can page, sort, and filter resource lists in the same request.
Tip: By default, resource lists are returned in an arbitrary order, and the order may not be the same if the request is issued more than once. To ensure that you get all the expected items when paging, specify a sort order in each request.