Export from a dashboard end to end
Find a dashboard, its widgets and its columns, then export them
Everything a dashboard shows can be exported over the API, with no visit to the web app in between: find the dashboard, list its widgets, list the columns of a table, then export. This page is that chain end to end, in four requests. The Export dashboard tables and Export charts pages document each request in full.
Two hosts are involved, using the same credentials: the Management API at https://management.api.exabel.com finds things, and the Export API at https://export.api.exabel.com exports them.
1. Find the dashboard
Search for folder items across every folder you can see, limited to dashboards:
curl --request GET \
--url 'https://management.api.exabel.com/v1/folders/-/items:search?query=weekly%20review&itemType=DASHBOARD' \
--header 'accept: application/json' \
--header 'x-api-key: xxx'{
"results": [
{
"item": {
"parent": "folders/45",
"name": "dashboards/1234",
"displayName": "Weekly review",
"itemType": "DASHBOARD"
}
}
],
"nextPageToken": ""
}The name — dashboards/1234 — names the dashboard from here on. Pass nextPageToken back as pageToken for the next page of results.
2. List its widgets
List dashboard widgets reports what the dashboard holds, in the order it appears in it:
curl --request GET \
--url https://management.api.exabel.com/v1/dashboards/1234/widgets \
--header 'accept: application/json' \
--header 'x-api-key: xxx'{
"widgets": [
{
"name": "dashboards/1234/widgets/1",
"displayName": "Revenue vs consensus",
"widgetType": "WIDGET_TYPE_CHART",
"chart": "charts/123"
},
{
"name": "dashboards/1234/widgets/2",
"displayName": "Weekly KPIs",
"widgetType": "WIDGET_TYPE_SIGNALS_TABLE"
}
]
}widgetType decides which export method applies: WIDGET_TYPE_SIGNALS_TABLE is a data file, WIDGET_TYPE_CHART is an image. Add ?widgetType=WIDGET_TYPE_SIGNALS_TABLE to ask for one kind only.
3. List the table's columns
List dashboard table columns reports the columns of one table, with the identifiers that name them in an export:
curl --request GET \
--url https://management.api.exabel.com/v1/dashboards/1234/widgets/2/columns \
--header 'accept: application/json' \
--header 'x-api-key: xxx'{
"columns": [
{"identifier": "c1f0a4b39d5e2c7a8b6d4f1e0a3c5b79", "displayName": "Company", "index": 0},
{"identifier": "5b7d1e3f0a9c2648e1d3b5a7c9f0e2d4", "displayName": "Revenue", "index": 1},
{"identifier": "9a3c5e7f1b0d2648a8c6e4f2d0b9a7c5", "displayName": "Last reported", "index": 2},
{"identifier": "3e8b0d6a2c4f1957b0a2c4e6d8f1a3b5", "displayName": "Gross margin", "index": 3}
]
}Position 0 holds the entity each row is about, and positions 1 and up are the data columns. There is no need to select position 0 when exporting: the entity columns come along regardless. An identifier changes when the column is edited, renaming included, so list the columns each time rather than storing one.
4. Export
A table becomes a data file, filtered and sorted as the request asks:
curl --request POST \
--url https://export.api.exabel.com/v1/export/dashboardTable \
--header 'x-api-key: xxx' \
--header 'content-type: application/json' \
--data '{
"table": "dashboards/1234/widgets/2",
"columns": [{"column": "5b7d1e3f0a9c2648e1d3b5a7c9f0e2d4"}],
"columnFilters": [
{"column": {"index": 2}, "dateFilter": {"insideRelativeDays": {"start": -7}}}
],
"columnOrderings": [{"column": {"column": "Revenue"}, "direction": "DESCENDING"}],
"outputFormat": "csv"
}' \
--output table.csvA chart becomes an image, for the entities and window the request asks for:
curl --request POST \
--url https://export.api.exabel.com/v1/export/chart \
--header 'x-api-key: xxx' \
--header 'content-type: application/json' \
--data '{"chart": "charts/123", "entities": ["entityTypes/company/entities/F_000C7F-E"]}' \
--output chart.pngBoth responses are the file itself rather than JSON, so write the body to disk instead of parsing it.
What each step is for
| Step | Needed when |
|---|---|
| Search folder items | The dashboard id is unknown. If it is known — copied from the dashboard's URL — start at step 2. |
| List widgets | Always, unless the widget number is already known. Widget ids are unique only within their dashboard. |
| List table columns | Exporting some columns rather than all of them, filtering, or sorting. A whole-table export needs only the widget name. |
| Export | Always. |
API key or access token?A customer-level API key operates as the service account user, and therefore only sees folders and library objects shared with the entire customer. To reach dashboards that are private to you, or shared with a smaller group, use a user-level API access token. See Management API Introduction.
Updated 1 day ago