Get measures (real)
This endpoint allows querying the real measures for a period of no more than 30 days.
GET /api/v1/business/{businessId}/product/{productId}/demand/from/{from}/to/{to}
The URL must contain the following parameters:
-
Business external identifier (businessId).
-
Product or section external identifier (productId).
-
Start date of the query in
yyyy-MM-dd
format (from). -
End date of the query in
yyyy-MM-dd
format (to).
If the data included in the request is correct, the response will contain the list of real measures for the product in the defined time range.
Below is a snippet of the response:
GET /api/v1/business/BUSINESSID/product/PRODUCTID/forecast/from/2024-07-15/to/2024-07-31
[
{
"value": 0.75,
"from": "2024-07-18T20:30:00.000Z",
"to": "2024-07-18T20:45:00.000Z",
"measure": "SALES"
},
{
"value": 0.75,
"from": "2024-07-18T20:45:00.000Z",
"to": "2024-07-18T21:00:00.000Z",
"measure": "SALES"
},
{
"value": 1.25,
"from": "2024-07-17T22:00:00.000Z",
"to": "2024-07-17T22:15:00.000Z",
"measure": "TICKETS"
},
{
"value": 1.25,
"from": "2024-07-17T22:15:00.000Z",
"to": "2024-07-17T22:30:00.000Z",
"measure": "TICKETS"
}
]
Considerations
This request returns the data for all measures of the product, unordered.
The data is always returned in UTC and in 15-minute intervals.
If there is no real measures for that period, the request will return an empty array []
.
If the product specified in the URL does not exist in the business, the request will return a 404 Not Found
error indicating not exists.
If the requested period exceeds 30 days, the request will return a 406 Not Acceptable
error.
Filter results
Since some businesses have numerous measures configured, this endpoint allows narrowing the response by filtering by type.
To do this, add the demandTypeNames
parameter to the URL:
GET /api/v1/business/{businessId}/product/{productId}/demand/from/{from}/to/{to}?demandTypeNames={demandTypeNames}
Example
GET /api/v1/business/BUSINESSID/product/PRODUCTID/demand/from/2024-07-15/to/2024-07-31?demandTypeNames=SALES
Snippet of the response:
[
{
"value": 1.25,
"from": "2024-07-17T22:00:00.000Z",
"to": "2024-07-17T22:15:00.000Z",
"measure": "SALES"
},
{
"value": 1.25,
"from": "2024-07-17T22:15:00.000Z",
"to": "2024-07-17T22:30:00.000Z",
"measure": "SALES"
},
{
"value": 1.25,
"from": "2024-07-17T22:30:00.000Z",
"to": "2024-07-17T22:45:00.000Z",
"measure": "SALES"
},
{
"value": 1.25,
"from": "2024-07-17T22:45:00.000Z",
"to": "2024-07-17T23:00:00.000Z",
"measure": "SALES"
}
]
To query multiple types of measures, multiple values can be included, separated by commas.
Example
GET /api/v1/business/BUSINESSID/product/PRODUCTID/demand/from/2024-07-15/to/2024-07-31?demandTypeNames=SALES,TICKETS
Snippet of the response:
[
{
"value": 1.0,
"from": "2024-07-17T21:30:00.000Z",
"to": "2024-07-17T21:45:00.000Z",
"measure": "TICKETS"
},
{
"value": 1.0,
"from": "2024-07-17T21:45:00.000Z",
"to": "2024-07-17T22:00:00.000Z",
"measure": "TICKETS"
},
{
"value": 1.25,
"from": "2024-07-17T22:00:00.000Z",
"to": "2024-07-17T22:15:00.000Z",
"measure": "SALES"
},
{
"value": 1.25,
"from": "2024-07-17T22:15:00.000Z",
"to": "2024-07-17T22:30:00.000Z",
"measure": "SALES"
}
]
If the |