Preview a widget without saving it
POST
/dashboard/preview-widget
Requires `dashboard:create`. Runs as the caller; nothing is cached. A widget that fails the schema is a 400 with `issues`. The widget `key` is optional here (a preview is never saved). `?tz=` is an IANA zone for datetime cells (an unknown zone reads as UTC); day buckets in aggregates are always UTC days.
Query Parameters
tzstring
Request Body
widget
Response Body
cachedboolean
data
disclosureobject,null
errorobject,null
expires_atstring,null
fetched_atstring,null
kindstring
Possible values:
metriccharttablemarkdown
row_visibilitystring,null
staleboolean
statestring
Possible values:
okemptyno_accesssource_error
table_pageobject,null
throttledboolean
widget_keystring
curl -X POST 'https://api.elaichi.ai/dashboard/preview-widget' \
-H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{}'const body = {};
const response = await fetch('https://api.elaichi.ai/dashboard/preview-widget', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
const data = await response.json();
console.log(data);import os
import requests
url = "https://api.elaichi.ai/dashboard/preview-widget"
headers = {
"Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
"Content-Type": "application/json",
}
payload = {}
response = requests.post(url, headers=headers, json=payload)
print(response.json())