Pagination

 This section:

  • Explains what pagination is
  • Defines the pagination parameters that are available to use
  • Provides example calls that include pagination parameters



What is pagination?

Pagination allows you to divide the results you receive from a call in to discrete chunks.

This is useful in situations where your call returns a large amount of data. For example, if you make a call asking for all the available stock in your inventory, you could end up with a very long list of results (depending on the size of your inventory). To prevent this from happening, we recommend that you use pagination parameters for the endpoints that support them.

The API does enforce default limits on results, however, they may differ depending on the part of the API you are using. For this reason, we recommend that you use the supported pagination parameters to handle the amount of results returned.



Pagination parameters

The pagination parameters supported by the API are:

ParameterDescription
limit

This parameter is used to limit the total number of results that a call returns.

For example, setting this parameter to 10 means a maximum of 10 results will be returned.

offset

This parameter is used to offset the returned results to begin at a particular record count.

For example, setting this parameter to 20 causes the query to skip the first twenty records in the data set.

Tip

To paginate your results you must use the limit and offset parameters together.

Info

Applying these parameters is optional.


Example calls

This example shows you how to limit the results to the first 10 items.

Call with a Limit of 10
GET "https://api.iot-x.com/available-stock?limit=10"          

This example shows you how to skip the first 20 results.

Call with an Offset of 20
GET "https://api.iot-x.com/available-stock?offset=20"         

This example shows you how to use limit and offset together to paginate your results.

Paginated Call
GET "https://api.iot-x.com/available-stock?offset=20&limit=10"

This call uses offset to skip the first 20 results and limit to return the next 10.