Skip to content

Commit

Permalink
Merge pull request #1594 from vtexdocs/fix-pagination-md
Browse files Browse the repository at this point in the history
remove _page parameter from master data pagination guide
  • Loading branch information
julia-rabello authored Nov 22, 2024
2 parents 66474ab + bd7f925 commit bf0a28c
Showing 1 changed file with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Pagination with the scroll endpoint is managed using three parameters:

* `_size`: Specifies the number of documents returned per request. The maximum value is 1000.
* `_token`: A unique token returned in the `X-VTEX-MD-TOKEN` header of the first request. This token is passed as a query parameter in subsequent requests to retrieve the next page of results. It expires in 20 minutes.
* `_page`: Specifies the page to retrieve.

In the initial request, you should only use `_size` to determine the number of results per page, as you will obtain the `_token` value in the `X-VTEX-MD-TOKEN` response header.

Expand All @@ -69,8 +68,6 @@ Example of an initial request:

>ℹ️ You can only define the page size in the first request. It cannot be changed in subsequent requests.
To obtain the next pages, you can choose between retrieving subsequent pages or retrieving a specific page. See details about each option in the following sections.

### Retrieving subsequent pages

Use the `X-VTEX-MD-TOKEN` header returned from the previous request as the `_token` query parameter in your next request to retrieve the subsequent pages. You can repeat this request until the response body is empty, indicating that there are no more documents to retrieve.
Expand All @@ -79,14 +76,6 @@ Subsequent requests to retrieve additional pages:

`GET /api/dataentities/{data_entity}/scroll?_token={X-VTEX-MD-TOKEN}`

### Retrieving specific pages

In case you want to specify the page to retrieve, include the `_page` query parameter. This is useful when you need direct access to a particular page without sequentially navigating through all prior pages.

Request to retrieve a specific page:

`GET /api/dataentities/{data_entity}/scroll?_token={X-VTEX-MD-TOKEN}&_page={page_number}`

### Checking if more pages are available

The `REST-Content-Total` response header provides the total number of documents that match your query, allowing you to calculate the number of pages available based on the `_size` parameter.
Expand Down

0 comments on commit bf0a28c

Please sign in to comment.