Skip to main content

Overview

RWS supports the main pagination methods for APIs, like simple, by offset, by cursor and by last ID, allowing efficient extraction of large volumes of data.

Pagination types supported by RWS

Simple Pagination

Page number and page size based

Offset Pagination

Uses offset and limit parameters

Cursor Pagination

Token-based pagination

Last ID Pagination

Uses last record ID for next page

Simple Pagination

Simple pagination uses page number and page size parameters to fetch data in chunks. It’s the most common pagination type.

How to identify

Your API uses simple pagination if:
  • Query parameters include page, page_number, pageNo, or similar
  • The API accepts both page number and page size parameters together
  • Example URLs: ?page=1&limit=10, ?page_number=2&page_size=50

How it works

The API expects two parameters:
  • Page number: Which page to retrieve (usually starts at 1 or 0)
  • Page size: How many records per page
Increment the page number for each subsequent request. The API returns pages until no more data is available.
RequestParameterPage returned
FirstGET /items?page=1&limit=10Page 1
SecondGET /items?page=2&limit=10Page 2
ThirdGET /items?page=3&limit=10Page 3 (or no more data)

Offset Pagination

Offset pagination uses an offset (starting position) and limit (number of records) to retrieve data.

How to identify

Your API uses offset pagination if:
  • Query parameters include offset, skip, start, or similar
  • The API uses offset combined with limit to control pagination
  • Example URLs: ?offset=0&limit=10, ?skip=20&take=50

How it works

The API expects:
  • Offset: The number of records to skip before starting to return results
  • Limit: The maximum number of records to return
Increase the offset by the limit amount for each subsequent page. For example, with limit=10: first page uses offset=0, second uses offset=10, third uses offset=20.
RequestParameterOffset returned
FirstGET /items?offset=0&limit=10offset=0
SecondGET /items?offset=10&limit=10offset=10
ThirdGET /items?offset=20&limit=10offset=20 (or no more data)

Cursor Pagination

Cursor pagination uses a token or cursor value to mark the position in the dataset.

How to identify

Your API uses cursor pagination if:
  • The API response includes a cursor, token, or “next” field pointing to the next page
  • Response includes fields like nextCursor, pageToken, next, cursor, or pagination.next
  • You need to pass a token from the previous response to get the next page
  • Example: Response contains {"data": [...], "pagination": {"nextCursor": "abc123"}}

How it works

The API provides a cursor or token in the response that points to the next page. The cursor can be either a token (string value) or a URL pointing to the next page. Extract the cursor from the current response and include it in your next request. The API uses this cursor to determine which records to return next. Each response contains a token that points to the next page. Use this token as a parameter in the next request.
RequestParameterResponse cursor
FirstGET /items?limit=10"nextCursor": "abc123"
SecondGET /items?limit=10&cursor=abc123"nextCursor": "xyz789"
ThirdGET /items?limit=10&cursor=xyz789"nextCursor": null
Pagination ends when the returned cursor is null or absent.

Last ID Pagination

Last ID pagination uses the ID of the last record from the current page to fetch the next page.

How to identify

Your API uses last ID pagination if:
  • Query parameters include after, since_id, last_id, or similar
  • The API requires passing the ID of the last record from the previous page
  • Records are ordered by ID and you fetch records with IDs greater than a given value
  • Example URLs: ?after=12345&limit=10, ?since_id=67890&per_page=50

How it works

Extract the ID of the last record from the current page and use it as a parameter to fetch the next page. The API returns records with IDs greater than the provided ID value. This approach prevents missing records even if new data is added while paginating, since you’re always fetching records after a specific ID.
RequestParameterLast ID returned
FirstGET /items?limit=10lastId: 100
SecondGET /items?limit=10&after=100lastId: 200
ThirdGET /items?limit=10&after=200lastId: null (or no more data)
Pagination ends when there are no more records with an ID greater than the last ID provided.