Import Historical Sales Data

In order for 7shifts’ machine learning algorithm to accurately forecast sales for restaurants, at least 90 days worth of the most recent historical sales data is required.

This data must be provided when an integration is first set up for a client to ensure that we are able to create accurate forecasts for them from the get-go.

In order to fulfill this, a separate service should be set up that can read the last 90 days worth of sales data, and send it in to 7shifts, one order at a time (7shifts currently does not offer a batch order import endpoint).

This service should be called into action only when an integration is first set up and a location in your system has been successfully mapped to a 7shifts location.

Requirements

  • This service must only be called between 08:00:00 UTC and 15:00:00 UTC following the integration being set up and a location being mapped.
  • Please do not make more than 10 requests per second per token.
  • You can use PUT /api/v2/company/{company_id}/location/{location_id}/orders/{external_id} (see the Orders guide) to send over this historical data.
  • Send your oldest historical order first. The first order sent for a location establishes that location's receipts-to-orders transition date, so sending anything but the oldest order first can leave earlier historical orders unreadable through the Orders read endpoints.

Tips

If there are far too many orders to be sent as a part of this historical data push, you may sum up the net totals of all orders within a 5-minute period into one new order and set the order_date for that order to be the start of the 5-minute time interval. This tactic should only be used for the historical data push, and not with regular orders being sent over to 7shifts.

For example, if there are 10 orders, each with a $10 net total within 9:05 AM and 9:10 AM UTC on July 1 2020, you can instead send just one order with request body fields set as follows:

curl --request PUT --url 'https://api.7shifts.com/api/v2/company/12345/location/7890/orders/historical-20200701-0905'
{
  "net_total": 10000,
  "gross_total": 10000,
  "order_date": "2020-07-01T09:05:00Z",
  "status": "closed",
  "payments": [],
  "line_items": []
}

The order's external_id (historical-20200701-0905 above) can be arbitrarily set, since it's unlikely this historical data needs updating. payments and line_items are required on every order write, but may be sent as empty arrays.

For the next 5-minute period from 9:10 AM to 9:15 AM, you can again set net_total/gross_total to the sum of all net totals from orders within that period, and set the order_date field to 09:10:00, and so on.


Did this page help you?