Stock Transfer API / Webhook

Kim HermanKim Herman Member Posts: 1

Hi there,

for an integration with our logistics partner, we would like to create an order in their system, when a stock transfer has been created in Lightspeed Retail from our warehouse to one of our physical stores.

Is there a webhook available when a stock transfer is in TO SEND status that we could use to call our code to transform that stock transfer into an order at our logistics partner ?

The flow I have in mind :

All store/warehouse locations are in Lightspeed retail.

5 comments

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 556 moderator
    edited October 10

    Hey @Kim Herman,

    Unfortunately, we don't have web-hooks. To accomplish your goals you will need to call the Inventory Transfer endpoint and use a timestamp filter.

    The request would look like this:

    https://api.lightspeedapp.com/API/Account/{accountID}/Inventory/Transfer.json?timeStamp=>,<{{startDate}},{{endDate}}

    With the startDate being the last time you made the above call and the endDate being the current time

    Essentially you would then need to store the current timestamp (of when you made the request into a database) along with all the Transfer items and their "status".

    Then the next time you make the request you can check if there are any new Transfers, using the "Count" field and if there are changes to the status.

    The three statuses that we return are "open, received and sent".

    You can then use the TransferID returned from the query to return the related items using the Transfer Items endpoint as needed like so:

    GET https://api.lightspeedapp.com/API/Account/{accountID}/Inventory/Transfer/{transferID}/TransferItems.json
    

    I hope this helps

    Adrian Samuel

    API Integrations Consultant - Strategic Solutions

    Lightspeed HQ

  • Maarten TroonbeeckxMaarten Troonbeeckx Member Posts: 3

    Hi Adrian,

    Tnx for your feedback.

    Reading through the docs and fetching transfer items like this:

    https://api.lightspeedapp.com/API/Account/{{accountID}}/Inventory/Transfer/29/TransferItems.json

    Since I need the SKU for each product, I would also like to eager load the Item data, but there doesn't seem to be a relation available in the docs.

    Is there something like this available, that might not be documented? E.g.:

    https://api.lightspeedapp.com/API/Account/{{accountID}}/Inventory/Transfer/29/TransferItems.json?load_relations=["Items"] <- ???

  • gregaricangregarican Member Posts: 331 

    While I doubt that there is an undocumented query parameter to load this relation, I have run into a few cases where I "guessed" at a query parameter that indeed was available :)

    I'd suggest just make a test API call using this URL and see if you hit paydirt. It definitely saves time and API bucket hits to be able to retrieve associated record data. Versus making separate API calls to get at the data...

  • Maarten TroonbeeckxMaarten Troonbeeckx Member Posts: 3

    Apparently it is possible using the "Transfer" endpoint instead with the "TransferItems.Item" relation, but only when fetching by ID...

    https://developers.lightspeedhq.com/retail/endpoints/Inventory-Transfer/

    E.g.:

    https://api.lightspeedapp.com/API/Account/{{accountID}}/Inventory/Transfer/29.json?load_relations=["TransferItems.Item"]

  • gregaricangregarican Member Posts: 331 

    @Maarten Troonbeeckx good find! So this is another example where it takes a couple of passes to get at the underlying details. If you want to pull product transfers over a specific criteria set, then once that set is passed back it has to be iterated over per-transfer to pull the actual item details.


    Since Lightspeed Retail is a cloud-based system, it's a shame that webbooks don't exist. Would make life so much easier than polling via the API. Not sure of the development road map, but if this area isn't on there it should be!

Sign In or Register to comment.