Get Date of Inventory Received on Purchase Order?

brendoncrawfordbrendoncrawford Posts: 7Member
Hello:

I am using this endpoint:
GET /api/purchase_orders/(d+)/
In the response, I see that there are created and a modified date fields.  These seem to indicate the date that the purchase order was created/uploaded and modified, but they do not indicate the date that the inventory was actually received.

In the API docs, I see that there is this endpoint:
POST /api/purchase_orders/(d+)/receive/
It will allow to specify when inventory is received, but there does not seem to be any way to fetch the information about when inventory for a purchase order was received.  Is there a way to get that information?

13 comments

  • Adrian SamuelAdrian Samuel Posts: 164Moderator, Lightspeed Staff moderator
    edited October 11
    Hey @brendoncrawford, thank you for the question; essentially the receivedDate is something that is set when you hit the "checkIn" button and doesn't relate to the actual reception of line items. You can manually change in the UI and or set via the API.

    What you're looking for is the data contained in the Order.SaleLines.SaleLine object.

    In any given Order.SaleLines.SaleLine.timeStamp, the time stamp set here will change to the latest time you received a given item so you should retrieve that from a GET request.
  • brendoncrawfordbrendoncrawford Posts: 7Member
    edited October 12
    Thanks for the response.
    I am having trouble finding Order.SaleLines.SaleLine. Which endpoint does that belong to?  I am looking at https://www.lightspeedhq.com/onsite-docs/contract_docs/generated_docs/api.orders.html , but I do not see any reference to that.

    Post edited by brendoncrawford on
  • jamesratcliffejamesratcliffe Posts: 153Administrator, Lightspeed Staff moderator
    @brendoncrawford Sorry, that's an endpoint for Lightspeed Retail, not OnSite.

    The receiving date isn't available on POs or PO line items through the API or client app.

    You can find receiving dates by running an Inventory History report filtering for a specific PO ID, but, unfortunately, the inventory history isn't available through the API.
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • brendoncrawfordbrendoncrawford Posts: 7Member
    edited October 12
    Thanks for the response.  We have a very large system which has been in development for over 8 months now, but our entire inventory analysis is rendered unusable due to this one issue. 
    It seems that this could be solved by just putting a received datetime field in the purchase order lineitem response, right?  It might not even require a whole new API endpoint.
    Would it be possible if you might be able to inquire if this could be added to the API?  I would be very appreciative, as the lack of this would derail our entire project, as the project is completely dependent on date-based inventory analysis.
    Thanks,
    Brendon

  • gregaricangregarican Posts: 121Member ✭
    @brendoncrawford I'll be keeping an eye on this thread. Our company too ran into some issues down the road that we weren't prepared for. During the brief trial demo we didn't have time to fully explore the API elements and scalability that our operations required.

    Now that we are in contract we have run into some roadblocks. That always come with the proviso of custom development since a lot of enhancements (much less fixes) aren't addressed by LS as a company. Outside of the ideas voting page.
  • jamesratcliffejamesratcliffe Posts: 153Administrator, Lightspeed Staff moderator
    The received datetime isn't stored in OnSite, so we can't just add a field.

    The closest you can get in any form is the inventory history.

    I spoke to one of our developers about adding the inventory history to the API. It would be possible, but a fair bit of work. I filed a ticket with Development to look into it and see if they want to do this and if so, how.

    @gregarican This is about Lightspeed OnSite, so it won't be relevant to you.
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • brendoncrawfordbrendoncrawford Posts: 7Member
    When we pull a purchase-order CSV report from the LightSpeed Desktop UI/App, it does contain the received date for a purchase-order product/lineitem, so this does seem indicate that the data exists, doesn't it?
  • jamesratcliffejamesratcliffe Posts: 153Administrator, Lightspeed Staff moderator
    @brendoncrawford I don't see the received date in the Purchase Orders report in ReportMaster or the PO export tool.

    Is this a custom field in the data you're testing on? If so, it would have to be filled in manually.

    You can get the custom fields from the PO search endpoint:

    https://www.lightspeedhq.com/onsite-docs/contract_docs/generated_docs/api.purchase_orders.html#api-purchase-orders-search

    Use a GET on the endpoint to see the custom fields set up on that database.
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • gregaricangregarican Posts: 121Member ✭
    The received datetime isn't stored in OnSite, so we can't just add a field.

    The closest you can get in any form is the inventory history.

    I spoke to one of our developers about adding the inventory history to the API. It would be possible, but a fair bit of work. I filed a ticket with Development to look into it and see if they want to do this and if so, how.

    @gregarican This is about Lightspeed OnSite, so it won't be relevant to you.
    While I realize it's not relevant from a platform-specific POV, it is in the big picture. So I'm curious as to how other LS customers fare getting quirks worked out, since they too are contracted and in production at the point where gaps have been discovered...
  • brendoncrawfordbrendoncrawford Posts: 7Member
    I sent you a support request with the specific CSV file that was exported, and an explanation of the data.

  • jamesratcliffejamesratcliffe Posts: 153Administrator, Lightspeed Staff moderator
    @brendoncrawford That's the inventory history report I mentioned earlier.

    The inventory history lists every change in inventory from invoices, POs, adjustments, etc. It's stored separately from the POs (and the other documents).

    There's no one-to-one mapping between the lines in that report and the PO (or even the PO line) because each line on a PO can be received (or partially received) individually, so you can easily have more than one date per PO and sometimes more than one date per PO line.

    Development is going to talk about adding inventory history or some kind of PO-specific status history to the API.
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
  • brendoncrawfordbrendoncrawford Posts: 7Member

    Ok thanks.  Do you think that the timeline for such a feature is closer to years, months, or weeks away?



  • jamesratcliffejamesratcliffe Posts: 153Administrator, Lightspeed Staff moderator
    I have no idea right now. Development will talk about it in a triage meeting this week, then I might have a better answer (but I might not).
    James Ratcliffe
    API Integrations Specialist
    Lightspeed HQ
Sign In or Register to comment.