/v2/catalog/list Pagination Error

Hi, i’m having issues using the Square “/v2/catalog/list” endpoint to get a list of menu items.

When the pagination cursor is not specified, the endpoint always returns correctly with the expected results. However right after when I pass in the pagination cursor, the call fails with:

{
    "category": "INVALID_REQUEST_ERROR",
    "code": "INVALID_VALUE",
    "detail": "Pagination cursor is not compatible with this request.",
    "field": "cursor"
}

Here is the pseudo code for the request being sent.

let get_menu = function() {
    ...
    let cursor = null;
    do {
        let resp = await client.catalogApi.listCatalog(cursor=cursor);
        cursor = JSON.parse(resp.body)['cursor'];
    } while (cursor != null);
    ...
};

My team and I did some debugging and we suspect it may be caused by different merchants calling “get_menu” in parallel. Any help on this issue will be greatly appreciated.

1 Like

+1 It’s disrupting our workflow. Square Team, please look into this.

We are using the following endpoint, which works fine if no pagination is provided but once the cursor is added it throws up that error. We have been using this endpoint for quite a while and it was working perfectly fine until today.
response = requests.get(f"https://connect.squareup.com/v2/catalog/list", headers={'Square-Version': '2021-05-13', 'Authorization': 'Bearer XXXXX', 'Content-Type': 'application/json'},params = {'cursor':'CAASMwoTNTk4MDY2NDE0OjU2NDQ1NjcxMhIcEAEQBBAGEAgQChAhECIQIxAlECYQJxApEC04ZA'})

Here’s the error that we are getting -
{'errors': [{'category': 'INVALID_REQUEST_ERROR', 'code': 'INVALID_VALUE', 'detail': 'Pagination cursor is not compatible with this request.', 'field': 'cursor'}]}

You may check the logs using below details -
Timestamp - 8/3/2021, 5:32:27 PM GMT+5:30
App id - sq0idp-dU9qSu4jNMVOy2L1hfn99w

Update: On further checking this endpoint, this seems to be random i.e it works sometimes but doesn’t work reliably (even after adding some delays between requests). I am still not sure as of what is causing the same endpoint to return 2 different outcomes

@sjosey @immanuel @Bryan-Square @Jordan we’d really appreciate if you guys can guide us up :slight_smile:

Hey there! The issue should be resolved on our end. Let us know if you are still hitting it or if you have any other questions.