Connecting Orders and Products

SAISAI Member Posts: 2
edited September 2019 in Development

Hi Lightspeed,

We've recently integrated the Lightspeed data into one of our partner platforms via API. my question is related to connecting the data.

what piece or pieces of data are returned in an order in the Orders response that can be linked back to a product in the Products response?

Im not sure what our account number is with Lightspeed, but company name is Air Canada. 

The 3 API endpoints we're consuming are

Customers: http://xxxxxx:[email protected]/en/customers.json

Products: http://xxxxxx:[email protected]/en/products.json

Orders: http://xxxxxx:[email protected]/en/orders.json

Please advise.




  • LeahLeah Moderator, Lightspeed Staff Posts: 222 moderator
    edited September 2019

    Hi @SAI The Order endpoint returns a link to the OrderProduct endpoint which contains a list of all products that are part of the order. This endpoint in turn, has a link to each individual product at the product endpoint itself which contains even further product details. Here are some links to our documentation:




    API Support
    Lightspeed HQ
  • SAISAI Member Posts: 2
    edited October 2019

    Hi Leah,

    Thank you for the comment. But we are stuck at pulling delta information.

    Looking at the data we get from the OrderProduct endpoint we are now not sure what is the correct way to do a delta load for this data. To explain: for the other endpoints we are importing(order, customer, product) we have a upsert logic based on <id> and <updatedat> fields, while for OrderProduct there is no <updatedat> field. The question then is: should we use the <updatedat> field from the order to do the upsert logic on the OrderProduct?

    Also, for the <id> field that we need to join the data we get from the Order endpoint with the data from the OrderProduct endpoint: as the Order endpoint returns a link to the OrderProduct endpoint(products_resource_url) can we add this to every OrderProduct we retrieve and use it as an <id> field to join Orders with OrderProduct?

    Also can you please provide API Document for OrderProduct.



    Post edited by SAI on
  • LeahLeah Moderator, Lightspeed Staff Posts: 222 moderator

    It sounds like you're using a platform of some kind to connect to our API? It may or may not be possible to do the same thing for the Order Product endpoint as for the other endpoints you are working with. You will have to consult our documentation (linked in the post just above) to see which fields you might be able to use to 'match' Orders with Order Products in your system. There are code examples in the documentation for those endpoints that will give you an idea of what you can expect to be returned. 

    Basically, getting data from the Order Products endpoint requires you to know the order number. So /orders/{order_id}/products.json will return all the order’s products along with their corresponding IDs and links to their individual resources (Product, Variant). This type of structure is found many of the other endpoints as well. The order product ID represents the specific link between the product and the order, the actual product itself is represented at the product and variant endpoints. You will have to figure out how to manage this on your end, depending on your needs and the requirements of your system.

    API Support
    Lightspeed HQ
Sign In or Register to comment.