Hi Leah, I would think it’s from 1 category. I’m trying to figure out how to change the url parameter and combine other specifics to show product out of 1 category. Is this possible?
The original question is posted in the Theme Design & Customizations category for Lightspeed eCom. It looks like your question is related to the Retail API, if this is the case I recommend posting in the correct Retail API category.
Now since you'll have to specify the number and not the name, you want to make an initial request to the Category endpoint to get that data. More information about this can be found here:
I tried playing around with this, and couldn't find a way to pass the proper query parameter. If I tried just two categoryID's like &categoryID=1,2 then only the second category ID would appear in the response. If I tried any more than two ID's then I got a query parameter error response. And bracket notation doesn't seem to work for passing multiple values in there.
If that all is the case, unless I'm missing something, I think you would have to derive the categoryID list all the top-level parent and all of its children. And pass the item query for each individual categoryID. Definitely not very efficient is you're talking about a deeper hierarchy and a lot of items.
Yes, that's long and not efficient. There has to be a way. I can't see this being built to not support this type of query. Hopefully someone on here knows the answer. @Adrian Samuel
I've kept repeating my strategy, so take it with a grain of salt if it doesn't apply or otherwise make sense. If you don't need near real-time data, I'd suggest just pulling the various recordsets via the API as part of a scheduled daily job. Push them into a local SQL-based DB table set. Then you can query things however you'd like.
As long as the enduser or the application can live with previous day's data as being most current, then the responsiveness is great. And you can link the different tables together however you'd like for better flexibility. Due to slice-and-dice requirements that might change at a later time.
Of course if you are looking at implementing a more real-time integrated app or reporting tool set that's all a moot point.
11 comments
?load_relations=["ItemShops", "ItemVendorNums"]&ItemShops.qoh=>,0
https://api.lightspeed.com/API/Account/{{AcccountId}}/Item.json?load_relations=["Category"]&categoryID={{number}}
Now since you'll have to specify the number and not the name, you want to make an initial request to the Category endpoint to get that data. More information about this can be found here:
https://developers.lightspeedhq.com/retail/endpoints/Category/
Adrian Samuel
Software Developer
Lightspeed HQ
Calling the parent category doesn’t pull the items that are in sub categories of that parent. Is there a way to make this happen?
https://api.merchantos.com/API/Account/{AccountId}/Item.json?load_relations=["Category"]&categoryID=1,2,3,4,5&limit=100
I tried playing around with this, and couldn't find a way to pass the proper query parameter. If I tried just two categoryID's like &categoryID=1,2 then only the second category ID would appear in the response. If I tried any more than two ID's then I got a query parameter error response. And bracket notation doesn't seem to work for passing multiple values in there.
If that all is the case, unless I'm missing something, I think you would have to derive the categoryID list all the top-level parent and all of its children. And pass the item query for each individual categoryID. Definitely not very efficient is you're talking about a deeper hierarchy and a lot of items.
As long as the enduser or the application can live with previous day's data as being most current, then the responsiveness is great. And you can link the different tables together however you'd like for better flexibility. Due to slice-and-dice requirements that might change at a later time.
Of course if you are looking at implementing a more real-time integrated app or reporting tool set that's all a moot point.