Paging

When working with a REST API, it’s a best practice to limit the number of items you’re retrieving to a reasonable amount. Especially if you’re not interested in getting everything at once. This way your response payload is smaller, and your requests are faster.

When an endpoint supports paging, the default and maximum page size will be specified in the endpoint documentation.

Each endpoint returns a totalCount parameter at the end of the response, which contains the total number of items in the collection. Most endpoints have a default limit on the maximum number of items they return. For example, if you have 500 Objectives, but the default limit of the /goals endpoint is 100, a request like >https://app.(us./as./sa.)quantive.com/results/api/v2/goals> will return only 100 items, and a totalCount: 500 at the end, informing you there’s more than just the 100 results it retrieves by default. In this case you must use paging to get to the other items. The Quantive Results REST API supports paging using the skip and take approach. To page through a collection, pass skip and take query parameters with the desired values in your URL.

Example:

You have 500 Objectives in your account. To page through this collection use the following algorithm:

Sorting your response is a must when you are paging though a large collection of items. Otherwise, you risk getting some items more than once and omitting some items entirely.

Quantive Results API V2 – the above examples for pagination will work with Quantive Results API V2 for the goals endpoint. Other V2 endpoints may support limit as a parameter as well. Check specific endpoint documentation to determine V2 compatibility.