Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove _page parameter from master data pagination guide #1594

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
julia-rabello marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[markdownlint] reported by reviewdog 🐶
MD024/no-duplicate-heading Multiple headings with the same content [Context: "### Retrieving subsequent page..."]


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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[markdownlint] reported by reviewdog 🐶
MD024/no-duplicate-heading Multiple headings with the same content [Context: "### Checking if more pages are..."]


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
Loading