Integration with LS API, Get products and stocks

KhakiKhaki Member Posts: 1

Hello,

I need some help and confirmation for my ideas :)

General view of idea:

  • Get products from LS API and save response in my DB
  • Get stocks of this products save response in my DB


I read the API documentation , i know i should send GET request on https://api.shoplightspeed.com/en/products.json

(documentation link: https://developers.lightspeedhq.com/ecom/endpoints/product/#get-all-products). But i do not want to get all products every time, is there any filter how I can filter products from last call date? ( i will set cron to pull data every 2 hours). Will these API respond me with all product data?

Next thing is GET stocks from LS API, i can not find in documentation API where i can ask about stocks for proper productId. Is there any API like this? I see Variant documentation but in fact i don't know how it works https://developers.lightspeedhq.com/ecom/endpoints/variant/

The same thing like in products, i want to update stocks in my DB every 10minutes, how i can filter these informations?


Best Regards

Khaki

1 comment

  • LucienVersendaalLucienVersendaal Moderator, Lightspeed Staff Posts: 413 moderator

    Hi @Khaki,

    Thank you for reaching out to us.

     But i do not want to get all products every time, is there any filter how I can filter products from last call date? ( i will set cron to pull data every 2 hours). Will these API respond me with all product data? What you can do is get all products first and put this is you DB, after that you can use the product Webhook. So when a product is updated the Webhook will be triggered and update your data in your DB.

     Next thing is GET stocks from LS API, i can not find in documentation API where i can ask about stocks for proper productId. Is there any API like this? I see Variant documentation but in fact i don't know how it works. Stock information is attached to variants not to products. When you're getting the variant, the productID is also in the response.

    In your case to get the product details and variant stock, you can use 1 call, and use this data to map correctly into your DB. Please check: https://developers.lightspeedhq.com/ecom/endpoints/catalog/

    I hope this helps.

Sign In or Register to comment.