dashboards
Add a component to a dashboard
POST
/
api
/
v1
/
dashboards
/
{dashboard_id}
/
components
Add a component to a dashboard
curl --request POST \
--url https://api.example.com/api/v1/dashboards/{dashboard_id}/components \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"component": {
"position": {
"row": 0,
"col": 0,
"width": 6,
"height": 4
},
"chart": {
"chart_id": "<string>",
"title_override": "<string>",
"refresh_interval_override": 1
},
"key_value": {
"label": "<string>",
"value": 123,
"unit": "<string>",
"description": "<string>",
"trend": {
"value": 123,
"is_percentage": true,
"label": "<string>"
},
"source_query": "<string>",
"refresh_interval": 30
},
"table": {
"title": "<string>",
"source_query": "<string>",
"columns": [
{
"key": "<string>",
"label": "<string>",
"col_type": "string",
"sortable": true,
"filterable": false,
"width": 123,
"format": "<string>"
}
],
"description": "<string>",
"default_page_size": 25,
"default_sort_field": "<string>",
"searchable": true,
"refresh_interval": 123
}
}
}
'import requests
url = "https://api.example.com/api/v1/dashboards/{dashboard_id}/components"
payload = { "component": {
"position": {
"row": 0,
"col": 0,
"width": 6,
"height": 4
},
"chart": {
"chart_id": "<string>",
"title_override": "<string>",
"refresh_interval_override": 1
},
"key_value": {
"label": "<string>",
"value": 123,
"unit": "<string>",
"description": "<string>",
"trend": {
"value": 123,
"is_percentage": True,
"label": "<string>"
},
"source_query": "<string>",
"refresh_interval": 30
},
"table": {
"title": "<string>",
"source_query": "<string>",
"columns": [
{
"key": "<string>",
"label": "<string>",
"col_type": "string",
"sortable": True,
"filterable": False,
"width": 123,
"format": "<string>"
}
],
"description": "<string>",
"default_page_size": 25,
"default_sort_field": "<string>",
"searchable": True,
"refresh_interval": 123
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
component: {
position: {row: 0, col: 0, width: 6, height: 4},
chart: {chart_id: '<string>', title_override: '<string>', refresh_interval_override: 1},
key_value: {
label: '<string>',
value: 123,
unit: '<string>',
description: '<string>',
trend: {value: 123, is_percentage: true, label: '<string>'},
source_query: '<string>',
refresh_interval: 30
},
table: {
title: '<string>',
source_query: '<string>',
columns: [
{
key: '<string>',
label: '<string>',
col_type: 'string',
sortable: true,
filterable: false,
width: 123,
format: '<string>'
}
],
description: '<string>',
default_page_size: 25,
default_sort_field: '<string>',
searchable: true,
refresh_interval: 123
}
}
})
};
fetch('https://api.example.com/api/v1/dashboards/{dashboard_id}/components', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/dashboards/{dashboard_id}/components",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'component' => [
'position' => [
'row' => 0,
'col' => 0,
'width' => 6,
'height' => 4
],
'chart' => [
'chart_id' => '<string>',
'title_override' => '<string>',
'refresh_interval_override' => 1
],
'key_value' => [
'label' => '<string>',
'value' => 123,
'unit' => '<string>',
'description' => '<string>',
'trend' => [
'value' => 123,
'is_percentage' => true,
'label' => '<string>'
],
'source_query' => '<string>',
'refresh_interval' => 30
],
'table' => [
'title' => '<string>',
'source_query' => '<string>',
'columns' => [
[
'key' => '<string>',
'label' => '<string>',
'col_type' => 'string',
'sortable' => true,
'filterable' => false,
'width' => 123,
'format' => '<string>'
]
],
'description' => '<string>',
'default_page_size' => 25,
'default_sort_field' => '<string>',
'searchable' => true,
'refresh_interval' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/dashboards/{dashboard_id}/components"
payload := strings.NewReader("{\n \"component\": {\n \"position\": {\n \"row\": 0,\n \"col\": 0,\n \"width\": 6,\n \"height\": 4\n },\n \"chart\": {\n \"chart_id\": \"<string>\",\n \"title_override\": \"<string>\",\n \"refresh_interval_override\": 1\n },\n \"key_value\": {\n \"label\": \"<string>\",\n \"value\": 123,\n \"unit\": \"<string>\",\n \"description\": \"<string>\",\n \"trend\": {\n \"value\": 123,\n \"is_percentage\": true,\n \"label\": \"<string>\"\n },\n \"source_query\": \"<string>\",\n \"refresh_interval\": 30\n },\n \"table\": {\n \"title\": \"<string>\",\n \"source_query\": \"<string>\",\n \"columns\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"col_type\": \"string\",\n \"sortable\": true,\n \"filterable\": false,\n \"width\": 123,\n \"format\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"default_page_size\": 25,\n \"default_sort_field\": \"<string>\",\n \"searchable\": true,\n \"refresh_interval\": 123\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/dashboards/{dashboard_id}/components")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"component\": {\n \"position\": {\n \"row\": 0,\n \"col\": 0,\n \"width\": 6,\n \"height\": 4\n },\n \"chart\": {\n \"chart_id\": \"<string>\",\n \"title_override\": \"<string>\",\n \"refresh_interval_override\": 1\n },\n \"key_value\": {\n \"label\": \"<string>\",\n \"value\": 123,\n \"unit\": \"<string>\",\n \"description\": \"<string>\",\n \"trend\": {\n \"value\": 123,\n \"is_percentage\": true,\n \"label\": \"<string>\"\n },\n \"source_query\": \"<string>\",\n \"refresh_interval\": 30\n },\n \"table\": {\n \"title\": \"<string>\",\n \"source_query\": \"<string>\",\n \"columns\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"col_type\": \"string\",\n \"sortable\": true,\n \"filterable\": false,\n \"width\": 123,\n \"format\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"default_page_size\": 25,\n \"default_sort_field\": \"<string>\",\n \"searchable\": true,\n \"refresh_interval\": 123\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/dashboards/{dashboard_id}/components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"component\": {\n \"position\": {\n \"row\": 0,\n \"col\": 0,\n \"width\": 6,\n \"height\": 4\n },\n \"chart\": {\n \"chart_id\": \"<string>\",\n \"title_override\": \"<string>\",\n \"refresh_interval_override\": 1\n },\n \"key_value\": {\n \"label\": \"<string>\",\n \"value\": 123,\n \"unit\": \"<string>\",\n \"description\": \"<string>\",\n \"trend\": {\n \"value\": 123,\n \"is_percentage\": true,\n \"label\": \"<string>\"\n },\n \"source_query\": \"<string>\",\n \"refresh_interval\": 30\n },\n \"table\": {\n \"title\": \"<string>\",\n \"source_query\": \"<string>\",\n \"columns\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"col_type\": \"string\",\n \"sortable\": true,\n \"filterable\": false,\n \"width\": 123,\n \"format\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"default_page_size\": 25,\n \"default_sort_field\": \"<string>\",\n \"searchable\": true,\n \"refresh_interval\": 123\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"slug": "<string>",
"columns": 123,
"version": 123,
"components": [
{
"id": "<string>",
"position": {
"row": 0,
"col": 0,
"width": 6,
"height": 4
},
"chart": {
"chart_id": "<string>",
"title_override": "<string>",
"refresh_interval_override": 123
},
"key_value": {
"id": "<string>",
"label": "<string>",
"value": 123,
"unit": "<string>",
"description": "<string>",
"trend": {
"value": 123,
"is_percentage": true,
"label": "<string>"
},
"source_query": "<string>",
"refresh_interval": 123
},
"table": {
"id": "<string>",
"title": "<string>",
"description": "<string>",
"source_query": "<string>",
"columns": [
{
"key": "<string>",
"label": "<string>",
"sortable": true,
"filterable": true,
"width": 123,
"format": "<string>"
}
],
"default_page_size": 123,
"default_sort_field": "<string>",
"searchable": true,
"refresh_interval": 123
}
}
],
"permissions": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"agent_id": 123
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
POST /dashboards/{id}/components
One component slot. Exactly one of chart / key_value / table must be set. component_type is required and must match the populated field.
Show child attributes
Show child attributes
Response
Successful Response
Full dashboard returned by the API.
Available options:
draft, published, archived Available options:
private, organization, public Show child attributes
Show child attributes
Related topics
Remove a component from a dashboardAdd a chart to the user's chat dashboard (user-triggered)Create a dashboardUnpublish a dashboardPublish a dashboard⌘I
Add a component to a dashboard
curl --request POST \
--url https://api.example.com/api/v1/dashboards/{dashboard_id}/components \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"component": {
"position": {
"row": 0,
"col": 0,
"width": 6,
"height": 4
},
"chart": {
"chart_id": "<string>",
"title_override": "<string>",
"refresh_interval_override": 1
},
"key_value": {
"label": "<string>",
"value": 123,
"unit": "<string>",
"description": "<string>",
"trend": {
"value": 123,
"is_percentage": true,
"label": "<string>"
},
"source_query": "<string>",
"refresh_interval": 30
},
"table": {
"title": "<string>",
"source_query": "<string>",
"columns": [
{
"key": "<string>",
"label": "<string>",
"col_type": "string",
"sortable": true,
"filterable": false,
"width": 123,
"format": "<string>"
}
],
"description": "<string>",
"default_page_size": 25,
"default_sort_field": "<string>",
"searchable": true,
"refresh_interval": 123
}
}
}
'import requests
url = "https://api.example.com/api/v1/dashboards/{dashboard_id}/components"
payload = { "component": {
"position": {
"row": 0,
"col": 0,
"width": 6,
"height": 4
},
"chart": {
"chart_id": "<string>",
"title_override": "<string>",
"refresh_interval_override": 1
},
"key_value": {
"label": "<string>",
"value": 123,
"unit": "<string>",
"description": "<string>",
"trend": {
"value": 123,
"is_percentage": True,
"label": "<string>"
},
"source_query": "<string>",
"refresh_interval": 30
},
"table": {
"title": "<string>",
"source_query": "<string>",
"columns": [
{
"key": "<string>",
"label": "<string>",
"col_type": "string",
"sortable": True,
"filterable": False,
"width": 123,
"format": "<string>"
}
],
"description": "<string>",
"default_page_size": 25,
"default_sort_field": "<string>",
"searchable": True,
"refresh_interval": 123
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
component: {
position: {row: 0, col: 0, width: 6, height: 4},
chart: {chart_id: '<string>', title_override: '<string>', refresh_interval_override: 1},
key_value: {
label: '<string>',
value: 123,
unit: '<string>',
description: '<string>',
trend: {value: 123, is_percentage: true, label: '<string>'},
source_query: '<string>',
refresh_interval: 30
},
table: {
title: '<string>',
source_query: '<string>',
columns: [
{
key: '<string>',
label: '<string>',
col_type: 'string',
sortable: true,
filterable: false,
width: 123,
format: '<string>'
}
],
description: '<string>',
default_page_size: 25,
default_sort_field: '<string>',
searchable: true,
refresh_interval: 123
}
}
})
};
fetch('https://api.example.com/api/v1/dashboards/{dashboard_id}/components', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/dashboards/{dashboard_id}/components",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'component' => [
'position' => [
'row' => 0,
'col' => 0,
'width' => 6,
'height' => 4
],
'chart' => [
'chart_id' => '<string>',
'title_override' => '<string>',
'refresh_interval_override' => 1
],
'key_value' => [
'label' => '<string>',
'value' => 123,
'unit' => '<string>',
'description' => '<string>',
'trend' => [
'value' => 123,
'is_percentage' => true,
'label' => '<string>'
],
'source_query' => '<string>',
'refresh_interval' => 30
],
'table' => [
'title' => '<string>',
'source_query' => '<string>',
'columns' => [
[
'key' => '<string>',
'label' => '<string>',
'col_type' => 'string',
'sortable' => true,
'filterable' => false,
'width' => 123,
'format' => '<string>'
]
],
'description' => '<string>',
'default_page_size' => 25,
'default_sort_field' => '<string>',
'searchable' => true,
'refresh_interval' => 123
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/dashboards/{dashboard_id}/components"
payload := strings.NewReader("{\n \"component\": {\n \"position\": {\n \"row\": 0,\n \"col\": 0,\n \"width\": 6,\n \"height\": 4\n },\n \"chart\": {\n \"chart_id\": \"<string>\",\n \"title_override\": \"<string>\",\n \"refresh_interval_override\": 1\n },\n \"key_value\": {\n \"label\": \"<string>\",\n \"value\": 123,\n \"unit\": \"<string>\",\n \"description\": \"<string>\",\n \"trend\": {\n \"value\": 123,\n \"is_percentage\": true,\n \"label\": \"<string>\"\n },\n \"source_query\": \"<string>\",\n \"refresh_interval\": 30\n },\n \"table\": {\n \"title\": \"<string>\",\n \"source_query\": \"<string>\",\n \"columns\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"col_type\": \"string\",\n \"sortable\": true,\n \"filterable\": false,\n \"width\": 123,\n \"format\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"default_page_size\": 25,\n \"default_sort_field\": \"<string>\",\n \"searchable\": true,\n \"refresh_interval\": 123\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/dashboards/{dashboard_id}/components")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"component\": {\n \"position\": {\n \"row\": 0,\n \"col\": 0,\n \"width\": 6,\n \"height\": 4\n },\n \"chart\": {\n \"chart_id\": \"<string>\",\n \"title_override\": \"<string>\",\n \"refresh_interval_override\": 1\n },\n \"key_value\": {\n \"label\": \"<string>\",\n \"value\": 123,\n \"unit\": \"<string>\",\n \"description\": \"<string>\",\n \"trend\": {\n \"value\": 123,\n \"is_percentage\": true,\n \"label\": \"<string>\"\n },\n \"source_query\": \"<string>\",\n \"refresh_interval\": 30\n },\n \"table\": {\n \"title\": \"<string>\",\n \"source_query\": \"<string>\",\n \"columns\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"col_type\": \"string\",\n \"sortable\": true,\n \"filterable\": false,\n \"width\": 123,\n \"format\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"default_page_size\": 25,\n \"default_sort_field\": \"<string>\",\n \"searchable\": true,\n \"refresh_interval\": 123\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/dashboards/{dashboard_id}/components")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"component\": {\n \"position\": {\n \"row\": 0,\n \"col\": 0,\n \"width\": 6,\n \"height\": 4\n },\n \"chart\": {\n \"chart_id\": \"<string>\",\n \"title_override\": \"<string>\",\n \"refresh_interval_override\": 1\n },\n \"key_value\": {\n \"label\": \"<string>\",\n \"value\": 123,\n \"unit\": \"<string>\",\n \"description\": \"<string>\",\n \"trend\": {\n \"value\": 123,\n \"is_percentage\": true,\n \"label\": \"<string>\"\n },\n \"source_query\": \"<string>\",\n \"refresh_interval\": 30\n },\n \"table\": {\n \"title\": \"<string>\",\n \"source_query\": \"<string>\",\n \"columns\": [\n {\n \"key\": \"<string>\",\n \"label\": \"<string>\",\n \"col_type\": \"string\",\n \"sortable\": true,\n \"filterable\": false,\n \"width\": 123,\n \"format\": \"<string>\"\n }\n ],\n \"description\": \"<string>\",\n \"default_page_size\": 25,\n \"default_sort_field\": \"<string>\",\n \"searchable\": true,\n \"refresh_interval\": 123\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"slug": "<string>",
"columns": 123,
"version": 123,
"components": [
{
"id": "<string>",
"position": {
"row": 0,
"col": 0,
"width": 6,
"height": 4
},
"chart": {
"chart_id": "<string>",
"title_override": "<string>",
"refresh_interval_override": 123
},
"key_value": {
"id": "<string>",
"label": "<string>",
"value": 123,
"unit": "<string>",
"description": "<string>",
"trend": {
"value": 123,
"is_percentage": true,
"label": "<string>"
},
"source_query": "<string>",
"refresh_interval": 123
},
"table": {
"id": "<string>",
"title": "<string>",
"description": "<string>",
"source_query": "<string>",
"columns": [
{
"key": "<string>",
"label": "<string>",
"sortable": true,
"filterable": true,
"width": 123,
"format": "<string>"
}
],
"default_page_size": 123,
"default_sort_field": "<string>",
"searchable": true,
"refresh_interval": 123
}
}
],
"permissions": [
"<string>"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"agent_id": 123
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}