Views

Create a View

Create a new view. A view is a table visualization of transformations that provides insight the output of transform functions. Views enable you to define columns that extract specific fields from transformation outputs, apply filters to narrow down the data, create aggregations for summary statistics, and query transformations from one or more functions.

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

Authenticate using API Key in request header

In: header

Request Body

application/json

name*string

Name of the view

columns*

List of columns in the view

filters*

List of filters applied to the view

aggregations*

List of aggregations defined for the view

functions*

List of functions that this view queries transformations from

Response Body

application/json

curl -X POST "https://api.bem.ai/v2/views" \  -H "Content-Type: application/json" \  -d '{    "name": "Invoice Overview",    "columns": [      {        "name": "Invoice Number",        "valueSchemaPath": [          "invoiceDetails",          "invoiceNumber"        ],        "displayOrderIndex": 0      }    ],    "filters": [      {        "columnName": "Invoice Amount",        "filterType": "equals_string"      }    ],    "aggregations": [      {        "name": "Total Revenue",        "function": "count"      }    ],    "functions": [      {        "id": "string",        "name": "string"      }    ]  }'
{
  "viewID": "v_2N6gH8ZKCmvb6BnFcGqhKJ98VzP",
  "name": "Invoice Overview",
  "description": "This view provides an overview of all invoices.",
  "displayType": "table",
  "currentVersionNum": 1,
  "columns": [
    {
      "name": "Invoice Number",
      "valueSchemaPath": [
        "invoiceDetails",
        "invoiceNumber"
      ],
      "displayOrderIndex": 0
    }
  ],
  "filters": [
    {
      "columnName": "Invoice Amount",
      "filterType": "equals_string",
      "string": "INV-123",
      "number": 1000
    }
  ],
  "aggregations": [
    {
      "name": "Total Revenue",
      "function": "count",
      "aggregateColumnName": "Invoice Amount",
      "groupByColumnName": "Customer Name"
    }
  ],
  "functions": [
    {
      "id": "string",
      "name": "string"
    }
  ]
}