Need Square Up API Pagination by page number

I am developing the SquareUp Api plugin. I have stuck to an issue.

I am not able to fetch data page wise. Your api documentation is showing only the Page Size as request parameter and returns a cursor for the next set of data.

But I want to pass [Page Number/OffSet] to the requested api call. How can I do this?

Ref: Pagination

Hope I can find the solution from your end ASAP.

Unfortunately, fetching data using a page number or offset isn’t currently available.

The Square API uses cursor-based pagination, which means that instead of specifying a page number or offset, you use a cursor to fetch the next set of results. Here’s a brief overview of how this works:

  1. Initial Request: You make an initial request specifying the limit (page size).
  2. Response with Cursor: The response includes a cursor if there are additional results to fetch.
  3. Subsequent Requests: Use the cursor in subsequent requests to fetch the next set of results. :slightly_smiling_face:

Hello, @sanchaki
Here’s how it works:

Initial Request: Specify the page size (limit) in your request.
Response with Cursor: The response includes a cursor if there are additional results.
Subsequent Requests: Use the cursor in subsequent requests to fetch the next set of results.
Here’s a brief example:
Initial Request
curl https://connect.squareup.com/v2/customers/search
-X POST
-H ‘Square-Version: 2021-12-15’
-H ‘Authorization: Bearer YOUR_ACCESS_TOKEN’
-H ‘Content-Type: application/json’
-d ‘{
“limit”: 2
}’

Response
JSON

{
“customers”: [
{ “id”: “1”, “name”: “Customer 1” },
{ “id”: “2”, “name”: “Customer 2” }
],
“cursor”: “NEXT_CURSOR”
}
Subsequent Request
curl https://connect.squareup.com/v2/customers/search
-X POST
-H ‘Square-Version: 2021-12-15’
-H ‘Authorization: Bearer YOUR_ACCESS_TOKEN’
-H ‘Content-Type: application/json’
-d ‘{
“limit”: 2,
“cursor”: “NEXT_CURSOR”
}’

This method ensures you can fetch data in chunks without specifying page numbers or offsets.

I hope this info is helpful to you.

Best Regard,
Gregory Chavez