Get Aggregated Sales

GET /f/finance/{businessLocationId}/aggregatedSales

Get sales for the current business day or the specified date range, aggregated by one or more values. The values are specified in the groupBy parameter and are nested in the order provided in the request.

  • Use either the date parameter or the from and to parameters to specify the period.
  • The date parameter specifies a single date for aggregation.
  • The from and to parameters specify a date-time range and must be used together.
  • If neither date nor from/to are provided it defaults to today's date.
  • The date range between from and to cannot exceed 365 days (1 year).

Path parameters

  • businessLocationId integer(int64) Required

    The unique identifier for the business location.

    Minimum value is 1.

Query parameters

  • date string(date)

    Specify a single date for which to retrieve aggregated sales data. Cannot be combined with from and to. Use either date, or both from and to.

  • from string(date-time)

    Specify the start datetime for the aggregation range. Must be used together with to. Cannot be combined with date.

  • to string(date-time)

    Specify the end datetime for the aggregation range. Must be used together with from. Cannot be combined with date.

  • flattened boolean

    Default value is false.

  • groupBy string Required

    Comma-separated list of parameters to group the results by. The allowed values are: staff, device, deviceId, tag, accountingGroup, and statisticGroup. For example, groupBy can be set to staff,device.

    Minimum length is 3, maximum length is 2147483647.

Responses

  • 200 application/json

    Aggregated sales returned

    Hide response attributes Show response attributes object
    • groupByKey string

      The groupBy parameter provided.

    • groupByValue string

      The value that corresponds to the groupBy parameter.

    • totalAmount string

      The aggregated total of sales for this data set (ex. staff: manager).

    • serviceCharge string

      The aggregated total of service charges for this data set (ex. staff: manager).

    • totalDiscountedAmount string

      The aggregated total of discounts for this data set (ex. staff: manager).

    • totalTaxAmount string

      The aggregated tax total for this data set (ex. staff: manager).

    • numberOfSales number

      The total number of sale lines for this data set (ex. staff: manager).

    • children array[object]
      Hide children attributes Show children attributes object
      • groupByKey string

        The second groupBy parameter provided, if applicable. The parameters will be nested based on the order provided. For example, staff,device will show totals for each staff value, and then those totals broken down by device.

      • children array[object]
        Hide children attributes Show children attributes object
        • groupByValue string

          The value that corresponds to the second groupBy parameter provided.

        • totalAmount string

          The aggregated total of sales for this nested data set (ex. staff:manager -> device: iPad7).

        • serviceCharge string

          The aggregated total of service charges for this nested data set (ex. staff:manager -> device: iPad7).

        • totalDiscountedAmount string

          The aggregated total of discounts for this nested data set (ex. staff:manager -> device: iPad7).

        • totalTaxAmount string

          The aggregated tax total for this nested data set (ex. staff:manager -> device: iPad7).

        • numberOfSales number

          The total number of sales for this nested data set (ex. staff:manager -> device: iPad7).

        • children array[object]
          Hide children attributes Show children attributes object
          • groupByKey string
          • children array[object]

            This would continue with as many nested data sets as specified by the groupBy parameters.

    • nextStartOfDayAsIso8601 string
    • dataComplete boolean
    • businessName string
  • 400 */*

    Bad Request

    Hide response attribute Show response attribute object
    • * object Additional properties
GET /f/finance/{businessLocationId}/aggregatedSales
curl \
 --request GET 'https://api.trial.lsk.lightspeed.app/f/finance/45454565682155/aggregatedSales?groupBy=string' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "groupByKey": "staff",
  "groupByValue": "manager",
  "totalAmount": "47.00",
  "serviceCharge": "0.00",
  "totalDiscountedAmount": "0.00",
  "totalTaxAmount": "7.04",
  "numberOfSales": 7.0,
  "children": [
    {
      "groupByKey": "device",
      "children": [
        {
          "groupByValue": "iPad7",
          "totalAmount": "28.00",
          "serviceCharge": "0.00",
          "totalDiscountedAmount": "0.00",
          "totalTaxAmount": "4.19",
          "numberOfSales": 3.0,
          "children": [
            {
              "groupByKey": "string",
              "children": [
                {}
              ]
            }
          ]
        }
      ]
    }
  ],
  "nextStartOfDayAsIso8601": "string",
  "dataComplete": true,
  "businessName": "string"
}
Response examples (400)
{
  "additionalProperty1": {},
  "additionalProperty2": {}
}