Using the API to retrieve sales data

jcaprajcapra Member Posts: 5
edited September 2017 in Development
Hello LightSpeed Onsiters!

Can we talk API? How can I achieve the same result as running a Sales Report on a Single Product through the API?

That's it! Thanks!

1 comment

  • jamesratcliffejamesratcliffe Administrator, Lightspeed Staff Posts: 160 moderator
    Hi James,

    The Invoice search endpoint can find you all the Invoices (for a specific date range) that have a given product on them:
    POST /api/invoices/search/

    <column id=""/>
    <filters> = 'P-1003' AND > '2017-10-01'</filters>
    You can add more columns, but the available columns relate to the invoice itself and not the line items.

    The response will be something like this:
    <?xml version="1.0" encoding="utf-8"?>
    <localizable_message type="">
    <invoice uri="https://localhost:9630/api/invoices/54/" id="54"/>
    You can then get the invoice line items from each invoice, take the ones that have the product on them, then format them into a report.
    James Ratcliffe
    Lightspeed HQ
Sign In or Register to comment.