How to get all items?

tegutegu Member Posts: 7

Hello,


Following the Postman examples (that I received in private) there is the following endpoint:

Account.Inventory -> Inventory (Get)

I would like to ask it is the proper endpoint to get every products?

After calling it, it says: count: 57347, which unreal - it supposed to be around 2-3 thousands.

Also where can I find documentation about this api?

From the documentation it is completely missing:

How can I return every items and how can I control the relations (I don't need relations: all);

7 comments

  • tegutegu Member Posts: 7

    Update:


    Or I should call the Account.Item (Get) endpoint?

    With the parameter: offset 0,1..20.. etc?

    It gives more realistic results.

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 299 moderator

    Hi

    Correct, you'll need to use the Items endpoint with the parameters. On the documentation page you'll find the relations: https://developers.lightspeedhq.com/retail/endpoints/Item/ if you want to know how to use multiple relations please check: https://developers.lightspeedhq.com/retail/introduction/relations/


    I hope this helps.

  • tegutegu Member Posts: 7

    Yes, definitely, thank you.


    Actually I have some more question.

    I try to retrieve every items with the Item endpoint. Like:

    https://{{host}}/API/Account/{{accountID}}/Item/?offset=30&limit=10000

    1. Limit parameter: is the max value 100?
    2. Offset parameter: it is working well, although the behavior is strange.

    There are 3063 items in total.

        "@attributes": {

            "count": "3063",

            "offset": "40",

            "limit": "100"

        },


    So when the offset is set to 30 it means that it should retrieve the last 63 items (or similar).

    But whatever value I set it keeps on retrieving 100 items.

    It is the expected behavior ?

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 299 moderator
  • tegutegu Member Posts: 7

    It says:

    offset - 0 - 0 to inf.

    Use this to skip a specified amount of objects. Useful for retrieving objects from endpoints that have more than 100 results.


    But it doesn't skip anything after reached the max item count, rather than 'circulating'...


    Practically in my case, when I set it 31 or higher, it has to skip 3100 items so it should return 0 items. Right?

  • tegutegu Member Posts: 7

    Okay, my bad, I start understanding the behavior.

    It's fine now.

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 299 moderator

    Perfect!

Sign In or Register to comment.