Resolve shop-day ranges for the company
POST/shop-days
Resolves date-range presets, explicit shop-day ranges, and instants against the company's time zone and shop-day start. Each day opens at the shop-day start in force on that day, as a wall-clock time in the company's time zone, so ranges stay aligned across daylight saving changes and changes to the shop-day start.
A shop day that starts before midnight is named by the date whose midnight it precedes.
Ranges are half-open: start is included and end is excluded. startDay and endDay are
the first and last shop days of the range, inclusive.
Presets:
today,yesterdaylast7Days,last30Days,last90Days: today and the prior N−1 shop days, ending at the end of todaylastWeek,lastMonth,lastYear: the previous complete week, month, or yearlast2Weeks: last week and this one, ending at the start of next weekweekToDate,monthToDate,quarterToDate,yearToDate: the start of the current unit to the end of today
Weeks start on the company's configured first day of the week, Monday unless configured otherwise.
Authentication: a signed-in user's token, or an API key or app token with the reporting or
user scope. A token without either scope gets a 403.
Instants (instants and at) need an explicit zone, Z or ±hh:mm up to ±14:00, and
instants and days must fall in the years 1900 to 2200 (an instant as a UTC instant).
A 400 reports the first problem found as the single entry in errors[], with field set
(e.g. presets[0], days[1].endDay) and one of these codes:
UnknownKey: a top-level request key other thanpresets,days,instantsoratUnknownPreset: a preset name that isn't one of the 13 presetsTooMany: a list longer than 100 entriesInvalidType: the body is an array, a list isn't an array, or a preset isn't a stringInvalidDay: astartDayorendDaythat isn't ayyyy-MM-dddate in 1900–2200InvalidRange: anendDaybefore itsstartDayInvalidDate: an instant oratthat isn't a zoned ISO 8601 date-time in 1900–2200
A body that isn't valid JSON, or is a bare JSON string, number or null, gets
400 { "message": "Problem parsing JSON" } without errors[].
Request
Responses
- 200
- 400
- 401
- 403
The resolved ranges and shop days, in request order
Bad request
Unauthorized
You do not have permission to access this resource