How to return all sold items in inventory

meatcomputermeatcomputer Posts: 21Member

Hey all,

what's the best api call to get me all sold items in my inventory?

All the best ,

Wouter

2 comments

  • meatcomputermeatcomputer Posts: 21Member

    is it not possible to do this?

  • Adrian SamuelAdrian Samuel Posts: 369Moderator, Lightspeed Staff moderator
    edited April 9

    Hey @meatcomputer, great question!

    The easiest way to do this would be to loop through your inventory and grab all the itemIDs and then programmatically pass it in as a search parameter into the sale endpoint like so

    https://api.lightspeedapp.com/API/{{accountID}}/Sale.json?load_relations=["SaleLines"]&SaleLines.itemID={{itemID}}

    Then you'd check if the ["@attributes"].count is greater than 0. Then you'll know if that item has been sold before.

    Hope this helps!

Sign In or Register to comment.