EP. Get Category Metrics Historical Values
Fetch the historical values of all metrics that are assigned a specific category.
URI
/api/v1/locations/{LOCATION_ID}/categories/{CATEGORY_ID}/trend?q={FILTER}
Request Query Parameters
| Request Parameter | Description | 
|---|---|
| LOCATION_ID | UUID assigned to a specific location | 
| CATEGORY_ID | ID of a target category | 
| FILTER | A base64 encoded filter query | 
{
  "type": "object",
    "properties": {
      "period": {
        "type": "string"
      },
      "scale": {
        "type": "string"
      },
      "date_from": {
        "type": "string"
      },
      "date_to": {
        "type": "string"
      },
      "scale": {
        "type": "string"
      },     
      "show_average": {
        "type": "boolean"
      },     
      "show_min": {
        "type": "boolean"
      },     
      "show_max": {
        "type": "boolean"
      },     
      "show_summary": {
        "type": "boolean"
      },     
      "display_hours": {
        "type": "string"
      },     
      "hide_zero_buckets": {
        "type": "boolean"
      }
    }
}
| Parameter | Description | Example/Valid Values | 
|---|---|---|
| period | Specifies the time period for the data. | CustomRange,FixedRange,Today,Yesterday,ThisWeek,LastWeek,ThisMonth,LastMonth | 
| scale | Determines the time bucket for each data value. | OneMinute,TenMinute,Hour,Day | 
| date_from | The RFC3339 date string representing the start of the data period. It should be the local time of the venue, represented in UTC.  Only used if periodisCustomRangeorFixedRange. | 2022-06-01T15:00:00Zmeans "3pm in the time zone of the venue". | 
| date_to | The end date for the data range. See comments above. | See above. | 
| show_average | A boolean indicating whether to show average values or not. | true,false | 
| show_min | A boolean indicating whether to show minimum values or not. | true,false | 
| show_max | A boolean indicating whether to show maximum values or not. | true,false | 
| event_value_type | Reserved. Always Count. | Count | 
| data_type | Reserved. Always use example value. | {"type": "Count", "value": "Count"} | 
| display_hours | Use Venue Operating Hours or 24 hours (when periodis e.g.Today) | OH,24H | 
| show_summary | A boolean indicating whether to show a summary of data or not. | true,false | 
| hide_zero_buckets | Valid for API requests that provide response with Content-Type: text/csv. A boolean indicating whether to exclude rows which have zero values only. | true,false | 
Sample Filter Query
This query requests historical data in the timeframe from 26/01/2024 07:00:00 to 26/01/2024 07:15:00. The historical data shall be presented as an average of metric values over 1 minute buckets.
{
  "period": "FixedRange",
  "date_from": "2024-01-26T07:00:00.000Z",
  "date_to":   "2024-01-26T07:15:00.000Z",
  "scale":    "OneMinute",
  "event_value_type": "Count",
  "show_average": true,
  "show_max": false,
  "show_min": false,
  "show_summary": false,
  "hide_zero_buckets": false,
  "extra_metrics": []
}
Response
{
  "type": "object",
  "properties": {
      "time_from": {
        "type": "number"
      },
      "time_to": {
        "type": "number"
      },
      "metrics": {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "metric_uuid": {
                    "type": "string"
                },
                "time_from": {
                    "type": "number"
                },
                "time_to": {
                    "type": "number"
                },
                "values": {
                    "type": "array",
                    "items": {
                        "type": "number"
                    }
                },
                "time": {
                    "type": "array",
                    "items": {
                        "type": "number"
                    }
                }
            }
        }
    }
}
| Response Parameter | Description | 
|---|---|
| metric_uuid | A unique identifier of a metric. | 
| time_from | A UNIX timestamp of a start time of the interval. | 
| time_to | A UNIX timestamp of an end time of the interval. | 
| time | An array of UNIX timestamps of buckets. | 
| values | An array of metric values calculated at a relevant bucket timestamp of timearray. | 
Sample Response
{
 "data": {
  "time_from": 1706252400,
  "time_to": 1706253300,
  "metrics": [
   {
    "metric_uuid": "93a4ae22-ffa5-488d-9b2f-58940a429062",
    "time_from": 1706252400,
    "time_to": 1706253300,
    "time": [
     1706252460,
     1706252520,
     1706252580,
     1706252640,
     1706252700,
     1706252760,
     1706252820,
     1706252880,
     1706252940,
     1706253000,
     1706253060,
     1706253120,
     1706253180,
     1706253240,
     1706253300,
     1706253360
    ],
    "values": [
     0.5,
     0.6666666666666666,
     0.6666666666666666,
     1,
     0.5,
     0.75,
     0.5,
     1,
     0.5,
     1,
     1,
     0.6666666666666666,
     0.6666666666666666,
     1,
     1,
     0.5
    ]
   },
   {
    "metric_uuid": "67b0acd4-49e2-4a62-846d-d10e1571ab10",
    "time_from": 1706252400,
    "time_to": 1706253300,
    "time": [
     1706252460,
     1706252520,
     1706252580,
     1706252640,
     1706252700,
     1706252760,
     1706252820,
     1706252880,
     1706252940,
     1706253000,
     1706253060,
     1706253120,
     1706253180,
     1706253240,
     1706253300,
     1706253360
    ],
    "values": [
     1.2727272727272727,
     1.5,
     0.6666666666666666,
     1.5555555555555556,
     1.3333333333333333,
     1,
     1.5,
     1.5,
     1.4444444444444444,
     1.5,
     1.4,
     1.5,
     0.6666666666666666,
     1.5555555555555556,
     1.4545454545454546,
     0.5
    ]
  ]
 },
 "success": true
}