iRetail PRO hub 1.0.0-m5: analytics
8 операций
← Вся документация · Источник: контракты, openapi/hub-v1.yaml на коммите 8000474.
Справочники на английском — на языке контрактов, из которых они созданы.
The chain's sales and stock (spec/ANALYTICS.md).
Операции
GET
/v1/analytics/metrics
The metrics the analytics query offers (metrics/catalog.json).
operationId
listAnalyticsMetrics · Право report.read
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
IRetail-App
|
header | string |
Which app sends the request, at which version: <app>/<version>, optionally a space and (<platform>), as cashier/1.2.0 (windows-x64) or manager/1.2.0 (web). The register (cashier), the back office and the console (manager) and the device gateway (gateway) send it on every request; a request without it is not one of the apps and is served as the current API, and a device token of an app's kind without it is an app of an unknown version; a header that does not parse counts as absent. The node may refuse an app 426 app_update_required by it, except on the operations marked x-app-update-exempt. Not a security boundary (spec/API.md, Transport; spec/RELEASES.md, Who is asking). |
Ответы
-
200OKMetricCatalog -
401Error (spec/API.md).Error -
403Error (spec/API.md).Error
POST
/v1/analytics/query
The chain's sales and stock by the metrics and dimensions asked (spec/ANALYTICS.md).
Reads only. 400 bad_request for an unknown metric or dimension, a dimension a metric does not allow, a period over 366 days or a malformed currency; 403 forbidden for a store outside the caller's scope; 422 mixed_currencies for money over stores of more than one currency without the store dimension or a currency to convert into.
operationId
queryAnalytics · Право report.read
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
IRetail-App
|
header | string |
Which app sends the request, at which version: <app>/<version>, optionally a space and (<platform>), as cashier/1.2.0 (windows-x64) or manager/1.2.0 (web). The register (cashier), the back office and the console (manager) and the device gateway (gateway) send it on every request; a request without it is not one of the apps and is served as the current API, and a device token of an app's kind without it is an app of an unknown version; a header that does not parse counts as absent. The node may refuse an app 426 app_update_required by it, except on the operations marked x-app-update-exempt. Not a security boundary (spec/API.md, Transport; spec/RELEASES.md, Who is asking). |
Тело запроса обязательный
application/jsonAnalyticsQuery
Ответы
-
200OKAnalyticsResult -
400Error (spec/API.md).Error -
401Error (spec/API.md).Error -
403Error (spec/API.md).Error -
422Error (spec/API.md).Error
GET
/v1/exchange-rates
The organization's exchange rates by day, newest first (spec/ANALYTICS.md, Currencies).
operationId
listExchangeRates · Право report.read
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
IRetail-App
|
header | string |
Which app sends the request, at which version: <app>/<version>, optionally a space and (<platform>), as cashier/1.2.0 (windows-x64) or manager/1.2.0 (web). The register (cashier), the back office and the console (manager) and the device gateway (gateway) send it on every request; a request without it is not one of the apps and is served as the current API, and a device token of an app's kind without it is an app of an unknown version; a header that does not parse counts as absent. The node may refuse an app 426 app_update_required by it, except on the operations marked x-app-update-exempt. Not a security boundary (spec/API.md, Transport; spec/RELEASES.md, Who is asking). |
from
|
query | string (date) |
The first date, included. |
to
|
query | string (date) |
The date after the last, excluded. |
currency
|
query | string |
Only pairs with this currency on either side. |
Ответы
-
200OKarray of ExchangeRate -
400Error (spec/API.md).Error -
401Error (spec/API.md).Error -
403Error (spec/API.md).Error
PUT
/v1/exchange-rates/{date}/{from}/{to}
Set the rate of a day for a pair.
operationId
putExchangeRate · Право rate.manage
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
date обязательный
|
path | string (date) |
The day the rate is for. |
from обязательный
|
path | string |
The currency converted from. |
to обязательный
|
path | string |
The currency converted into. |
IRetail-App
|
header | string |
Which app sends the request, at which version: <app>/<version>, optionally a space and (<platform>), as cashier/1.2.0 (windows-x64) or manager/1.2.0 (web). The register (cashier), the back office and the console (manager) and the device gateway (gateway) send it on every request; a request without it is not one of the apps and is served as the current API, and a device token of an app's kind without it is an app of an unknown version; a header that does not parse counts as absent. The node may refuse an app 426 app_update_required by it, except on the operations marked x-app-update-exempt. Not a security boundary (spec/API.md, Transport; spec/RELEASES.md, Who is asking). |
Тело запроса обязательный
application/jsonExchangeRatePut
Ответы
-
200OKExchangeRate -
400Error (spec/API.md).Error -
401Error (spec/API.md).Error -
403Error (spec/API.md).Error
DELETE
/v1/exchange-rates/{date}/{from}/{to}
Remove the rate of a day for a pair.
operationId
deleteExchangeRate · Право rate.manage
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
date обязательный
|
path | string (date) |
The day the rate is for. |
from обязательный
|
path | string |
The currency converted from. |
to обязательный
|
path | string |
The currency converted into. |
IRetail-App
|
header | string |
Which app sends the request, at which version: <app>/<version>, optionally a space and (<platform>), as cashier/1.2.0 (windows-x64) or manager/1.2.0 (web). The register (cashier), the back office and the console (manager) and the device gateway (gateway) send it on every request; a request without it is not one of the apps and is served as the current API, and a device token of an app's kind without it is an app of an unknown version; a header that does not parse counts as absent. The node may refuse an app 426 app_update_required by it, except on the operations marked x-app-update-exempt. Not a security boundary (spec/API.md, Transport; spec/RELEASES.md, Who is asking). |
Ответы
POST
/v1/exchange-rates/import
Import rates from CSV: a header date,from,to,rate, then one rate per line.
operationId
importExchangeRates · Право rate.manage
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
IRetail-App
|
header | string |
Which app sends the request, at which version: <app>/<version>, optionally a space and (<platform>), as cashier/1.2.0 (windows-x64) or manager/1.2.0 (web). The register (cashier), the back office and the console (manager) and the device gateway (gateway) send it on every request; a request without it is not one of the apps and is served as the current API, and a device token of an app's kind without it is an app of an unknown version; a header that does not parse counts as absent. The node may refuse an app 426 app_update_required by it, except on the operations marked x-app-update-exempt. Not a security boundary (spec/API.md, Transport; spec/RELEASES.md, Who is asking). |
Тело запроса обязательный
text/csvstring
Ответы
-
200OKExchangeRateImport -
400Error (spec/API.md).Error -
401Error (spec/API.md).Error -
403Error (spec/API.md).Error
GET
/v1/reports/bonuses
Employee bonuses over the chain's stores, by store and employee.
operationId
hubBonusReport · Право bonus.read
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
IRetail-App
|
header | string |
Which app sends the request, at which version: <app>/<version>, optionally a space and (<platform>), as cashier/1.2.0 (windows-x64) or manager/1.2.0 (web). The register (cashier), the back office and the console (manager) and the device gateway (gateway) send it on every request; a request without it is not one of the apps and is served as the current API, and a device token of an app's kind without it is an app of an unknown version; a header that does not parse counts as absent. The node may refuse an app 426 app_update_required by it, except on the operations marked x-app-update-exempt. Not a security boundary (spec/API.md, Transport; spec/RELEASES.md, Who is asking). |
from обязательный
|
query | string (date-time) |
Inclusive. |
to обязательный
|
query | string (date-time) |
Exclusive. |
store_id
|
query | string (uuid) |
One store's. |
Ответы
-
200OKHubBonusReport -
400Error (spec/API.md).Error -
401Error (spec/API.md).Error -
403Error (spec/API.md).Error
GET
/v1/reports/partners
Partners over the chain's stores, by store and partner.
operationId
hubPartnerReport · Право report.read
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
IRetail-App
|
header | string |
Which app sends the request, at which version: <app>/<version>, optionally a space and (<platform>), as cashier/1.2.0 (windows-x64) or manager/1.2.0 (web). The register (cashier), the back office and the console (manager) and the device gateway (gateway) send it on every request; a request without it is not one of the apps and is served as the current API, and a device token of an app's kind without it is an app of an unknown version; a header that does not parse counts as absent. The node may refuse an app 426 app_update_required by it, except on the operations marked x-app-update-exempt. Not a security boundary (spec/API.md, Transport; spec/RELEASES.md, Who is asking). |
from обязательный
|
query | string (date-time) |
Inclusive. |
to обязательный
|
query | string (date-time) |
Exclusive. |
store_id
|
query | string (uuid) |
One store's. |
Ответы
-
200OKHubPartnerReport -
400Error (spec/API.md).Error -
401Error (spec/API.md).Error -
403Error (spec/API.md).Error
Схемы
MetricCatalog object
metrics обязательный
|
array of Metric |
Metric object
id обязательный
|
string |
|
name обязательный
|
LocalizedText |
|
description обязательный
|
LocalizedText |
|
unit обязательный
|
MetricUnit |
|
dimensions обязательный
|
array of AnalyticsDimension |
MetricUnit "money" | "quantity_milli" | "count" | "ppm" | "minutes"
money · quantity_milli · count · ppm · minutes
AnalyticsDimension "store" | "day" | "week" | "month" | "hour" | "employee" | "item" | "group"
store · day · week · month · hour · employee · item · group
AnalyticsQuery object
metrics обязательный
|
array of string |
Metric ids from the catalog. |
dimensions
|
array of AnalyticsDimension |
|
from обязательный
|
string (date) |
The first local date, included. |
to обязательный
|
string (date) |
The local date after the last, excluded; at most 366 days after from. |
stores
|
array of string (uuid) |
By default every store the caller may read. |
items
|
array of string (uuid) |
|
groups
|
array of string (uuid) |
Items now in these groups. |
currency
|
string |
Convert money into this currency at the rate of each day (spec/ANALYTICS.md, Currencies). |
roll_up_variants
|
boolean |
Count a variant under its parent in the item dimension (spec/VARIANTS.md). |
order_by
|
string |
A requested metric or dimension; by default the dimensions in order. |
descending
|
boolean |
|
limit
|
integer |
AnalyticsColumn object
id обязательный
|
string |
|
kind обязательный
|
"dimension" | "metric" |
|
unit обязательный
|
MetricUnit | null |
A metric's unit; null for a dimension. |
AnalyticsResult object
columns обязательный
|
array of AnalyticsColumn |
|
rows обязательный
|
array of array of string | integer | null |
|
currency обязательный
|
string | null |
The asked currency, or the rows' one currency, null when they differ or carry no money. |
missing_rates обязательный
|
array of object |
The store currencies and days left out of the sums for want of a rate, sorted. |
truncated обязательный
|
boolean |
More rows matched than limit. |
ExchangeRate object
date обязательный
|
string (date) |
|
from обязательный
|
string |
|
to обязательный
|
string |
|
rate обязательный
|
string |
Units of to one unit of from buys, as decimal text (never a float). |
ExchangeRatePut object
rate обязательный
|
string |
Units of to one unit of from buys, as decimal text (never a float). |
ExchangeRateImport object
imported обязательный
|
integer |
Rows written (a rate for an existing day and pair replaces it). |
refused обязательный
|
array of object |
Rows not written, with the line number and why. |
HubBonusReport object
spec/REPORTS.md, Employee bonuses and At the hub. Rows by store id, then employee id; totals per currency, never added across currencies.
from обязательный
|
string (date-time) |
|
to обязательный
|
string (date-time) |
|
rows обязательный
|
array of object |
|
totals обязательный
|
array of object |
One entry per currency the rows are in, ordered by currency code; empty with no rows. |
HubPartnerReport object
spec/REPORTS.md, Partners and At the hub. Rows by store id, then partner id; totals per currency, never added across currencies.
from обязательный
|
string (date-time) |
|
to обязательный
|
string (date-time) |
|
rows обязательный
|
array of object |
|
totals обязательный
|
array of object |
One entry per currency the rows are in, ordered by currency code; empty with no rows. |