Custom Metrics API
Add Custom Metric
post /custom_metricsAdds a new metric which will be immutable and can only be deleted.
Custom Metric Object
{ "key": "cm_revenue_total_budget", "grouping": "date_store", "type": "scalar", "format": "money"}
HTTP Status Code Summary | |
---|---|
201 | Returns the added Custom Metric object. |
400 | Invalid request |
401 | Unauthorized |
429 | Too many requests |
500 | Internal Server Error |
Get Custom Metrics
get /custom_metricsGet list of Custom Metrics. Use filter keys
to filter out specific Custom Metrics.
An optional comma separated list of Custom Metric keys to retrieve.
[ { "key": "cm_revenue_total_budget", "grouping": "date_store", "type": "scalar", "format": "money" }]
HTTP Status Code Summary | |
---|---|
200 | Arra of Custom Metrics |
401 | Unauthorized |
429 | Too many requests |
Delete Custom Metric
delete /custom_metrics/{key}Delete a Custom Metric and all data associated with it.
Key of the metric
HTTP Status Code Summary | |
---|---|
200 | Custom Metric deleted OK |
401 | Unauthorized |
404 | Custom Metric key does not exist |
429 | Too many requests |
500 | An error occurred deleting Custom Metric or its values |
Get Custom Metric Values
get /custom_metric_valuesGet list of Custom Metric Values. All metrics that match the filter will be returned. Note that query parameters for date
and store
only filter values that are grouped on them. E.g. a metric grouped on store_id
will be returned if the query param for store_id
matches (regardless if query parameter for date
is passed or not)
Comma separated list of keys for metrics to retreive.
The first date to retrieve values for in valid ISO format (YYYY-MM-DD).
Number of days to retrieve values for. Default is 1. Min is 1 and max is 100
The ID for the store that the Custom Metric data belongs to.
[ { "key": "cm_revenue_total_budget", "date": "2020-12-11", "store_id": "12345", "value_scalar": 10000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-12", "store_id": "12345", "value_scalar": 15000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-13", "store_id": "12345", "value_scalar": 11000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-14", "store_id": "12345", "value_scalar": 7000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-15", "store_id": "12345", "value_scalar": 10000 }]
HTTP Status Code Summary | |
---|---|
200 | |
400 | Invalid request |
401 | Unauthorized |
429 | Too many requests |
Update Custom Metric Values
put /custom_metric_valuesSet values for Custom Metrics
Array of Custom Metric Value objects
[ { "key": "cm_revenue_total_budget", "date": "2020-12-11", "store_id": "12345", "value_scalar": 10000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-12", "store_id": "12345", "value_scalar": 15000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-13", "store_id": "12345", "value_scalar": 11000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-14", "store_id": "12345", "value_scalar": 7000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-15", "store_id": "12345", "value_scalar": 10000 }]
[ { "key": "cm_revenue_total_budget", "date": "2020-12-11", "store_id": "12345", "value_scalar": 10000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-12", "store_id": "12345", "value_scalar": 15000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-13", "store_id": "12345", "value_scalar": 11000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-14", "store_id": "12345", "value_scalar": 7000 }, { "key": "cm_revenue_total_budget", "date": "2020-12-15", "store_id": "12345", "value_scalar": 10000 }]
HTTP Status Code Summary | |
---|---|
200 | |
400 | Invalid request |
401 | Unauthorized |
429 | Too many requests |
500 | One or more of the requested items could not be inserted |
Delete Custom Metric Values
delete /custom_metric_values/{key}All values for Custom Metrics that match the filter will be deleted. Note that query parameters for date
and store
only filter values that are grouped on them. E.g. a metric grouped on store_id
will be matched if the query param for store_id
matches (regardless if query parameter for date
is passed or not)
Key of the metric to delete data for.
Date of the metric values to delete in ISO format (YYYY-MM-DD).
Number of days starting from date to delete values from. Default is 1. Min is 1 and max is 100.
Deletes data only for this Store
HTTP Status Code Summary | |
---|---|
200 | Custom Metric Values deleted OK |
400 | Invalid input |
401 | Unauthorized |
404 | Custom Metric key does not exist |
429 | Too many requests |
500 | One or more of the requested items could not be deleted. |
Objects
CustomMetricobject
The name of the Custom Metric. Must start with "cm_"
none
No grouping. Only one value can exist.date
Group by date. One value per date is possible.store
Group by store. One value per store is possible.date_store
Group by store and date. One value per store and date is possible.
VALUES |
---|
none |
date |
store |
date_store |
scalar
Scalar Metricseries
Series Metric
VALUES |
---|
scalar |
series |
number
Numeric valueinteger
Integer valuemoney
Money value (^[-+]?[0-9]+.[0-9]{2}$)percent
Percentage value
VALUES |
---|
number |
integer |
money |
percent |
CustomMetricValueobject
The name of the Custom Metric
Required if metric grouping is date
or date_store
Required if metric grouping is store
or date_store
(Dashboard engine will map this value to the External ID of store)
Value. Set if metric type is scalar
Series. Set if metric type is series
The total number of items for the series (The returned series may not include all items)
The total value for the series (The actual series may not include all values)
Errorobject
An http status code
Text describing the error