Pagination

Most endpoints which return a list of items will limit the total number of items in the response. Partners are strongly encouraged to use the limit and offset query parameters to create pagination for these endpoints, allowing users to move through an entire list of items.

The limit parameter specifies the maximum number of possible items to include in the response. When this parameter is absent, the default for the endpoint will be used. This is typically 100 but can vary depending on the endpoint.

The offset parameter moves through the items, skipping the initial ones and returning those available at the specified position. When absent, this parameter typically defaults to zero. Some endpoints may use a default of 1.

In the example below, we are asking for the first 10 activities in Italy:

Copy
Copied
curl -X GET '{baseUrl}/activities?country_in=IT&limit=10' \
-H 'X-Musement-Application: {applicationValue}' \
-H 'X-Musement-Version: 3.4.0' \
-H 'Authorization: Bearer {accessToken}'

To get the next 10 activities, we use the offset parameter, equal to the limit parameter value:

Copy
Copied
curl -X GET '{baseUrl}/activities?country_in=IT&limit=10&offset=10' \
-H 'X-Musement-Application: {applicationValue}' \
-H 'X-Musement-Version: 3.4.0' \
-H 'Authorization: Bearer {accessToken}'

To get 10 more activities, we add 10 to the offset parameter:

Copy
Copied
curl -X GET '{baseUrl}/activities?country_in=IT&limit=10&offset=20' \
-H 'X-Musement-Application: {applicationValue}' \
-H 'X-Musement-Version: 3.4.0' \
-H 'Authorization: Bearer {accessToken}'

We can continue this trend until the response provides less items than the specified limit. When this happens, there are no more items to display.

Copyright © TUI Musement. All rights reserved.