Offset in Catalog Vendor Item

shreyansshreyans Posts: 14Member
Hi, 

I am trying to use catalog vendor item API to get all the catalog vendor in the account. The problem here is this query only gives 100 records at a time and using offset to fetch more records gives this error. 

{
    "httpCode": "403",
    "httpMessage": "Forbidden",
    "message": "\"offset\" not allowed for CatalogVendorItem",
    "errorClass": "Exception"
}

I need a way to get all the data, not just 100 records. Is it possible to achieve this ?


 https://developers.lightspeedhq.com/retail/endpoints/CatalogVendorItem/ 

7 comments

  • Adrian SamuelAdrian Samuel Posts: 353Moderator, Lightspeed Staff moderator
    @shreyans it's probably because the total count is 100.

    The first object you get from the API returns the Attributes object:
    {    "@attributes": {        "count": "100",        "offset": "0",        "limit": "100"    },

    Adding an offset to iterate over the next 100 results which doesn't exist will return a 403

  • shreyansshreyans Posts: 14Member
    edited December 2018
    @Adrian Samuel

    No, that is not the case, 
    I tried setting the limit to 1 and offset to 1, 
    even then I got the same error. 

    https://api.lightspeedapp.com/API/Account/{accountID}/CatalogVendorItem.json?offset=1&limit=1
  • Adrian SamuelAdrian Samuel Posts: 353Moderator, Lightspeed Staff moderator
    @shreyans this is expected behaviour because limiting your results to 1 means that the default offset is 0.

    Setting the offset to 1 means you're querying for data that doesn't exist in the request you've made.

    This works fine:

    https://api.lightspeedapp.com/API/Account/{accountID}/CatalogVendorItem.json?offset=0&limit=1

    But essentially with our catalogue search you need to specify the ID for the item. You're not going to be able to get more than the first 100 objects returned from a read response

    So your request should look like this:

    https://api.lightspeedapp.com/API/Account/{accountID}/CatalogVendorItem/{{CatalogVendorItemID}}.json
  • shreyansshreyans Posts: 14Member
    @Adrian Samuel

    "Setting the offset to 1 means you're querying for data that doesn't exist in the request you've made."

    I can't get it to work even after removing the limit parameter entirely. 

    Only offset 0 works, can you give me another example were any other offset apart from 0 works. 

    Thanks


    This is what is written about limit in the documentation.

    limit100 0 to     100Controls the number of objects returned. Maximum limit is 100.
  • shreyansshreyans Posts: 14Member
    Also, is there no way I can get all the Catalog vendor items in an account ? 
  • Adrian SamuelAdrian Samuel Posts: 353Moderator, Lightspeed Staff moderator
    @shreyans interesting discovery!

    It is not possible to get all the Catalog Vendor Items in an account. This is something we are aware of and seek to address.

    I think this all shows how presently the CatalogVendorItem isn't fit for the purpose you presently have for it.
Sign In or Register to comment.