Views

Generate View Aggregation Data

Generate aggregation results for a view. This endpoint executes the view's aggregations against transformations from the specified functions, applies the defined filters, and returns aggregated values. The request includes the view configuration (columns, filters, aggregations, function IDs) and a time window to filter transformations by creation date. The response contains an array of aggregation results, where each aggregation contains groups and their aggregated values. For grouped aggregations, multiple groups are returned (up to 200 groups per aggregation). For non-grouped aggregations, a single group with an empty group name is returned. Supported aggregation functions include count (total count of rows), count_distinct (count of unique values in a column), sum (sum of numeric values), average (average of numeric values), min (minimum numeric value), and max (maximum numeric value). Note: The functions field in the view configuration is required. At least one function ID or name must be specified.

POST
/v2/views/aggregation-data
x-api-key<token>

Authenticate using API Key in request header

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://api.bem.ai/v2/views/aggregation-data" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "columns": [      {        "name": "string",        "valueSchemaPath": [          "string"        ],        "displayOrderIndex": 0      }    ],    "filters": [      {        "columnName": "string",        "filterType": "equals_string"      }    ],    "aggregations": [      {        "name": "string",        "function": "count"      }    ],    "functions": [      {}    ],    "timeWindow": {      "start": "2019-08-24T14:15:22Z",      "end": "2019-08-24T14:15:22Z"    }  }'
{
  "aggregations": [
    {
      "name": "string",
      "groups": [
        {
          "groupName": "string",
          "value": 0.1
        }
      ]
    }
  ]
}
{
  "message": "string",
  "code": 0,
  "details": {}
}