get the total sales for particular period of time for selected products (bug)

SergeyBaredSergeyBared Member Posts: 1

Hi,
I am trying to get the total sales for particular period of time for selected products through the Lightspeed API.

I have found SaleLine function for this purpose:
https://developers.lightspeedhq.com/retail/endpoints/Sale-SaleLine/#get-single-sale-saleline

I would like to get sales for the period 1.May 2018 - 20.May 2018 for two selected products:
with SKU=10261 and with SKU=11210.

When I run the API call with 11210 the endpoint is:
SaleLine.json?itemID=11210&timeStamp=>,2018-05-01T00:00:00-0400&timeStamp=<,2018-05-20T00:00:00-0400
and result set is correct.

But if I run the API with 10261:
SaleLine.json?itemID=10261&timeStamp=>,2018-05-01T00:00:00-0400&timeStamp=<,2018-05-20T00:00:00-0400
the API call returns ALL sales regardless the selected period of time.


2 comments

  • gregaricangregarican Member Posts: 663 
    What do the sales for ItemID 10261 look like when you see them in the LS Retail web client? Sometimes I ran into something similar when looking up other transactions with a date range as a query parameter. When I should be getting back an empty result set I got back all transactions that appear to be based on wide-open query parameters.
  • Michael CareyMichael Carey Administrator, Lightspeed Staff Posts: 68 moderator
    Hi Sergey,

    I think that there's an issue with the way the query parameters get executed that I haven't quite figured out yet. I will need to keep testing this but in the mean time I recommend that you use the 'between' operator instead of greater than and lesser than. 

    <pre class="CodeBlock"><code>/SaleLine.json?itemID=10261&timeStamp=%3E%3C,2018-05-01T00:00:00-0400,2018-05-20T00:00:00-0400

    Thanks,

    Michael Carey

    Product Manager
    Lightspeed HQ
Sign In or Register to comment.