Querying Item Endpoint for Only Archived Records

gregaricangregarican Member Posts: 333 

Here's a practical example where I think I have run into another gotcha regarding API response. We are removing a good chunk of aged, stale inventory from stock. We own the items so it's not a vendor return. We are "scrapping" them. But need to report out as to which specific SKU's we scrapped.


Now that our inventory team has gone into Lightspeed Retail, zeroed out the quantity, and archived them we need to report out on them for financials and asset reconciliation. If we run a Lightspeed Retail report in the web client (e.g. - Inventory Log Report for anything Archived and Removed), these reports don't show any SKU whatsoever. No System SKU, Custom SKU, or Manufacturer SKU. Which is another issue entirely, in how these web client reports typically don't uniquely identify product other than a short description which isn't unique. Same with a RTV report in the web client. You'd think a vendor would need to know the Manufacturer SKU of what's being returned in some document. How impractical is that?


Anyway, when I query the Item API endpoint, I am looking for any items that have the keyword "scrapped" in the notes, that are in Archived status, and were last touched over the past two days. Here is my URI:


https://api.merchantos.com/API/Account/{AccountId}/Item.json?load_relations=["Note"]&archived=true&timeStamp=><,2019-11-04T00:00:01-5:00,2019-11-06T23:59:59-5:00&Note.note=~,%scrapped%


The API response is a result set that includes both items with archived: "false" and archived: "true." Any suggestions as to why this is the case?

4 comments

  • gregaricangregarican Member Posts: 333 

    @Alex Lugo can you please speak to this when you get a chance? If there is something different I can employ in the URI then that's an easy fix. Otherwise I cannot get at the data we need either through the web client or the API. 😕

  • gregaricangregarican Member Posts: 333 

    Anyone???

  • Alex LugoAlex Lugo Administrator, Lightspeed Staff Posts: 155 moderator

    Hello @gregarican,

    The archived parameter accept 3 parameters, true, false and only, if you need only the archived items use archived=only, true will give you archived and non-archived objects and false will give you non-archived objects.

    Alex Lugo
    API Support Specialist
    Lightspeed HQ
  • gregaricangregarican Member Posts: 333 

    Ahhh, that makes sense! Thanks for the feedback. I will make a note of this for future runs. Appreciate the help!

Sign In or Register to comment.