Get projections

This endpoint allows querying the measure projections for a period of no more than 30 days.

GET /api/v1/business/{businessId}/product/{productId}/projections/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 measures (projections) for the product in the defined time range.

Below is a snippet of the response:

GET /api/v1/business/BUSINESSID/product/PRODUCTID/projections/from/2024-07-15/to/2024-07-31
[
    {
        "value": 1.8601585848683944,
        "from": "2024-07-28T02:30:00.000Z",
        "to": "2024-07-28T02:45:00.000Z",
        "measure": "GCS"
    },
    {
        "value": 0.08022429012201047,
        "from": "2024-07-25T22:30:00.000Z",
        "to": "2024-07-25T22:45:00.000Z",
        "measure": "GCS_HD"
    },
    {
        "value": 2.701181238256684,
        "from": "2024-07-15T15:30:00.000Z",
        "to": "2024-07-15T15:45:00.000Z",
        "measure": "GCS_TOTAL"
    },
    {
        "value": 0.1862209126582066,
        "from": "2024-07-22T19:15:00.000Z",
        "to": "2024-07-22T19:30:00.000Z",
        "measure": "GCS_HD"
    },
    {
        "value": 48.63102243138213,
        "from": "2024-07-23T17:45:00.000Z",
        "to": "2024-07-23T18:00:00.000Z",
        "measure": "SALES"
    }
]

Considerations

This request returns the projection data for all measures of the product, unordered.

The data is always returned in UTC and in 15-minute intervals.

If there is no projection data 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}/projections/from/{from}/to/{to}?demandTypeNames={demandTypeNames}
Example
GET /api/v1/business/BUSINESSID/product/PRODUCTID/projections/from/2024-07-15/to/2024-07-31?demandTypeNames=SALES

Snippet of the response:

[
    {
        "value": 6.680319714002887,
        "from": "2024-07-15T12:00:00.000Z",
        "to": "2024-07-15T12:15:00.000Z",
        "measure": "SALES"
    },
    {
        "value": 6.680319714002887,
        "from": "2024-07-15T12:15:00.000Z",
        "to": "2024-07-15T12:30:00.000Z",
        "measure": "SALES"
    },
    {
        "value": 6.680319714002887,
        "from": "2024-07-15T12:30:00.000Z",
        "to": "2024-07-15T12:45:00.000Z",
        "measure": "SALES"
    },
    {
        "value": 6.680319714002887,
        "from": "2024-07-15T12:45:00.000Z",
        "to": "2024-07-15T13:00:00.000Z",
        "measure": "SALES"
    },
    {
        "value": 13.885344664795607,
        "from": "2024-07-15T13:00:00.000Z",
        "to": "2024-07-15T13:15: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/projections/from/2024-07-15/to/2024-07-31?demandTypeNames=SALES,GCS_HD

Snippet of the response:

[
    {
        "value": 6.680319714002887,
        "from": "2024-07-15T12:00:00.000Z",
        "to": "2024-07-15T12:15:00.000Z",
        "measure": "SALES"
    },
    {
        "value": 6.680319714002887,
        "from": "2024-07-15T12:15:00.000Z",
        "to": "2024-07-15T12:30:00.000Z",
        "measure": "SALES"
    },
    {
        "value": 6.680319714002887,
        "from": "2024-07-15T12:45:00.000Z",
        "to": "2024-07-15T13:00:00.000Z",
        "measure": "SALES"
    },
    {
        "value": 0.20486311995461887,
        "from": "2024-07-15T13:15:00.000Z",
        "to": "2024-07-15T13:30:00.000Z",
        "measure": "GCS_HD"
    },
    {
        "value": 0.20486311995461887,
        "from": "2024-07-15T13:30:00.000Z",
        "to": "2024-07-15T13:45:00.000Z",
        "measure": "GCS_HD"
    }
]

If the demandTypeNames parameter is not specified, the request will return all measures of the product within the specified date range.