Order Search pagination issues

Hi Square,

I’m trying to use the SearchOrders endpoint to pull down a couple years worth of orders.
No matter how I set it up, I’m only getting about 3 months of results?

If I use no “limit” then I get 518 records in the response and then it stops. If I use limit=[some value] then it pages until it hits 518 records and then stops.

We have payments going back to 2020 and the orders should go back that far also. I found that if I block out the start-end date filters and send about 1 month at a time it will return orders further back than 3 months.

Is there some rate limit or size limit I’m hitting when I try to search orders for over 3 months?

Cheers,
Steve

With SearchOrders you’ll need to paginate through the orders using the returned cursor from the initial request.

Pagination is a process that is used to divide a large dataset into smaller chunks (pages). All Square API endpoints that return a list of resources support pagination. For example, the SearchCustomers endpoint (Customers API) and ListCustomerRefunds endpoint (Refunds API) support pagination. Each request to these endpoints returns a page of the result set.

When the result is truncated (there are more resources to retrieve), the response also returns a cursor field.

For example, suppose your SearchCustomers result set is 100 customers but the page returned in the response has only 10 customers. In this case, the response includes a cursor. You include this cursor in the subsequent SearchCustomers request to retrieve the next page (next set of customers). As long as each call results in a response that includes a cursor, you continue to send SearchCustomers requests (in each request include the cursor returned in the previous response). The last page of the result set does not include a cursor. :slightly_smiling_face:

Hi Brian,

I really appreciate your detailed response! I apologize, my question was not framed correctly.
I am seeing and using the “cursor” in the response. It just seems that the values coming back from the cursor are stopping before it has returned all the data.

Actually I was making up a document of screenshots to illustrate when I discovered that the ETL tool (Matillion) I’m using to pull these seems to be the issue (possibly). On one of the responses, the only data coming back (from what I could see in the log) is the cursor. I’m not sure how that’s possible.

At that point the ETL tool stopped sending additional requests.

When I manually grabbed that cursor and restarted the extract it continued on and completed. Maybe it’s data related but I have all the data and I’ll just let it go at that for now.

The cursor approach seems to be working it’s just my tool not handling the response correctly I think.

Cheers,
Steve

Glad to hear that you got all the results. Hmm, that’s definitely odd that it would stop like that. I’d recommend that you share this with Matillion cause if we return a cursor it should definitely paginate through all the results. :slightly_smiling_face:

1 Like

Thanks Bryan,

Yes I’ve raised with Matillion already a similar issue. They have built-in Square connectors but they have multiple issues. I’ll raise this one also and hopefully it will get some attention.

Thanks again for your help.

Steve