Creating Purchase Order with Multiple Orderlines

ManavAggarwalManavAggarwal Member Posts: 5

Hi,

I am trying to create a purchase order in lightspeed via salesforce integration using the APIs. I am able to successfully create an order, but when I enter multiple order line items, it creates only the first one. I am not able to find anything in the documentation. Does Lightspeed API not support bulk uploads? Or am I looking at the wrong place? (https://developers.lightspeedhq.com/retail/endpoints/OrderLine/)

Tags:

5 comments

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

    Hello @ManavAggarwal,

    It's not possible to make bulk uploads, each orderline needs to be created individually.

    Alex Lugo
    API Support Specialist
    Lightspeed HQ
  • ManavAggarwalManavAggarwal Member Posts: 5

    Hi Alex,

    Thanks for the response.

    The trouble I am facing with creating each orderline individually is that I hit the rate limit very frequently.

    So far my team is not able to come up with an effective workaround to send orderlines without hitting Error 429.

    Any suggestion would be really helpful.

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

    Hello @ManavAggarwal,

    You will need to adjust your API request calls by looking at the header X-LS-API-Bucket-Level which provides the current drip rate and the current level of your bucket

    https://developers.lightspeedhq.com/retail/introduction/bestpractices/#respect-the-rate-limit

    Alex Lugo
    API Support Specialist
    Lightspeed HQ
  • ManavAggarwalManavAggarwal Member Posts: 5

    Hi @Alex Lugo

    The problem is that we are unable to send multiple records in one go due to no Bulk API and are also unable to send multiple records individually due to rate limiting.

    At this point, we are stuck and don't really have anywhere to go. The code from my end is opitmized to send requests only when necessary, but that is also proving a challenge.

    I can buy 10 different products which will make 5 different line items. Sending them together along with an order record will cause the integration to fail in the first transaction itself.

    Since the integration needs to be real-time, we cannot wait for the bucket to empty before sending the next batch.

    Please advise.

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

    Hello @ManavAggarwal,

    Would it be possible for you to confirm that you want to create a Purchase Order and not a Sale? When you create a sale, is it possible to create a sale with multiple saleLines in the same API request. Purchase Orders is the list of items that merchants will acquire from one of their vendors vs. sales, which are transaction between the merchants and a customer.

    Alex Lugo
    API Support Specialist
    Lightspeed HQ
Sign In or Register to comment.