Skip to main content
POST
/
team
/
{team_id}
/
datasets
/
quick-create
cURL
curl --request POST \
  --url https://api.chartbrew.com/team/{team_id}/datasets/quick-create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "team_id": 123,
  "project_ids": [
    123
  ],
  "draft": true,
  "dimension": "<string>",
  "metric": "<string>",
  "metricOperation": "none",
  "dateField": "<string>",
  "dateFormat": "<string>",
  "legend": "<string>",
  "conditions": [
    {
      "id": "<string>",
      "field": "<string>",
      "operator": "is",
      "value": "<string>",
      "displayValues": true
    }
  ],
  "fieldsSchema": {},
  "joinSettings": {
    "joins": [
      {
        "dr_id": 123,
        "join_id": 123,
        "dr_field": "<string>",
        "join_field": "<string>",
        "alias": "<string>"
      }
    ]
  },
  "dataRequests": [
    {
      "connection_id": 123,
      "method": "GET",
      "route": "<string>",
      "headers": [
        {
          "key": "<string>",
          "value": "<string>"
        }
      ],
      "body": "<string>",
      "useGlobalHeaders": true,
      "query": "<string>",
      "pagination": false,
      "itemsLimit": 0,
      "offset": "offset",
      "paginationField": "<string>",
      "template": "<string>",
      "conditions": [
        {
          "field": "<string>",
          "operator": "<string>",
          "value": "<string>"
        }
      ],
      "configuration": {
        "populateAttributes": true,
        "mainCollectionSample": "<string>",
        "subCollectionSample": "<string>",
        "selectedSubCollection": "<string>",
        "limit": 123,
        "orderBy": "<string>",
        "orderByDirection": "asc",
        "accountId": "<string>",
        "propertyId": "<string>",
        "metrics": "<string>",
        "dimensions": "<string>",
        "startDate": "<string>",
        "endDate": "<string>",
        "limitToLast": 123,
        "limitToFirst": 123
      },
      "transform": {
        "enabled": true,
        "type": "<string>",
        "configuration": {}
      },
      "variableBindings": [
        {
          "name": "<string>",
          "type": "string",
          "default_value": "<string>",
          "required": true
        }
      ]
    }
  ],
  "main_dr_index": 0,
  "variableBindings": [
    {
      "name": "<string>",
      "type": "string",
      "default_value": "<string>",
      "required": true
    }
  ]
}'
{
  "id": 123,
  "team_id": 123,
  "project_ids": [
    123
  ],
  "chart_id": 123,
  "connection_id": 123,
  "draft": true,
  "query": "<string>",
  "xAxis": "<string>",
  "xAxisOperation": "<string>",
  "yAxis": "<string>",
  "yAxisOperation": "none",
  "dateField": "<string>",
  "dateFormat": "<string>",
  "legend": "<string>",
  "fieldsSchema": {},
  "excludedFields": [
    "<string>"
  ],
  "configuration": {},
  "joinSettings": {
    "joins": [
      {
        "dr_id": 123,
        "join_id": 123,
        "dr_field": "<string>",
        "join_field": "<string>"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

team_id
string
required

ID of the team

Body

application/json

Create a dataset with all its data requests in one API call

team_id
integer
required

ID of the team

project_ids
integer[]

Array of project IDs where members can access the dataset

draft
boolean
default:true

Whether the dataset is a draft and should be hidden from dashboard viewers

dimension
string

X axis or metric field using traversal syntax - root[].field

metric
string

Y axis field using traversal syntax

metricOperation
enum<string>
default:none

Operation to perform on the y-axis - none, sum, avg, min, max, count

Available options:
none,
count,
count_unique,
sum,
avg,
min,
max
dateField
string

Date field using traversal syntax. Specifies which field should be used for date filtering.

dateFormat
string

Date format to use for date filtering. e.g YYYY-MM-DD

legend
string

Legend label (name) of the dataset

conditions
object[]

Conditions to apply to the dataset - used for filtering

fieldsSchema
object

Schema of the fields in the dataset key(field name) => value(type). This gets populated automatically whenever the dataset is used in a chart.

joinSettings
object

Join settings for the dataset. Use indices (0-based) in joins array to reference data requests before they are created.

dataRequests
object[]

Array of data requests to create with the dataset

main_dr_index
integer
default:0

Index (0-based) of the main data request in the dataRequests array. Defaults to 0.

variableBindings
object[]

Variable bindings for the dataset. The entity_type and entity_id will be automatically set.

Response

Created dataset with all data requests

id
integer
team_id
integer
project_ids
integer[]
chart_id
integer
connection_id
integer
draft
boolean
default:true
query
string
xAxis
string
xAxisOperation
string
yAxis
string
yAxisOperation
string
default:none
dateField
string
dateFormat
string
legend
string
fieldsSchema
object
excludedFields
string[]
configuration
object
joinSettings
object