API Pagination

Some guidance and instructions on how pagination is implemented on the VORJ API.

A user can customize their data pagination by setting the number of items per page, specifying the sorting field and direction, and providing the lastItemPrimary when navigating to subsequent pages. In cases where two or more items have the same value for the sorting field, the lastItemSecondary can be used to help differentiate items.

ParameterDescriptionRequiredNote

limit

Max number of items to be returned in a given page

No (default value= 10)

Minimum limit value is 10 and max limit value is 100

sortingField

The field by which the list of items is sorted before it's paginated or divided into smaller, manageable sections for display.

Yes (in some cases there will be a default value)

In some cases this field won't be present. In that case we are sorting by a set field, this set filed will be in API description so user knows what value to use for lastItemPrimary.

sortingDirection

Defines the order in which the items in a paginated list are arranged. Can take two values asc and desc.

  • asc(ascending): In this sorting direction, items are arranged in ascending order.

  • desc (descending): In this sorting direction, items are arranged in descending order

Yes

lastItemPrimary

Refers to the value of the sorting field of the last item in the page of results. This value is used to determine which items are displayed on the current page and which items appear on the subsequent page when navigating through paginated data.

Yes (not required to get 1st page)

lastItemSecondary

In cases where two or more items have the same value for the sorting field, the lastItemSecondary comes into play. It's an additional attribute or field that can be used to differentiate these items. I VORJ we used the objects _id value as this ensures uniqueness

No

sortingMarketplace

This field is used in some of the marketplace endpoints and is used to determine which marketplace to sort by.

No (default value = all)

This field is used in marketplace endpoints as there is embedded information in the items returned. When using the sortingField parameter in these marketplace endpoints, you would specify the sortingMarketplace to narrow down the sorting to a particular marketplace.

Last updated