Data Retrieval
Download a dashboard as PDF
Render an embedded dashboard for one customer as a PDF file.
curl --request POST https://api.usedatabrain.com/api/v2/data-app/getDashboardPdf \ --header "Authorization: Bearer $DATABRAIN_API_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "dataAppId": "7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f", "embedId": "sales-overview", "dashboardId": "sales-overview", "clientId": "acme", "pageSetup": { "orientation": "landscape" } }' \ --output sales-overview.pdfAuth
A data app API token, or a service token. With a service token, dataAppId picks the data app. See Authentication.
ApiTokenAuthorizationBearer <token>A service token or a data app API token.
Body
The data app id. Required when you use a service token. With a data app API token you can leave it out, and Databrain uses the token's data app. If you send it, it must be that token's data app.
The embed id. You must send it, but Databrain does not use it to find the dashboard. dashboardId does that.
The embed's dashboard id. This picks the dashboard.
The tenant whose data is shown.
Multi-datasource workspaces: the datasource. Databrain checks that the name exists and reads the tenancy from it. Each metric still runs on its own datasource.
Multi-datamart workspaces: the datamart. Databrain checks that the name exists and reads the tenancy from it. Each metric still runs on its own datasource.
Page size and table limits of the PDF.
5 fields in pageSetup
One of landscape, portrait. Page orientation.
One of auto, one-up, two-up. Charts per row.
One of paginate, all. Split long tables over pages, or show all rows.
Response
The PDF file, with Content-Type: application/pdf, as an attachment.
The call waits until the file is ready. There is no job id and nothing to poll. A large dashboard can take some time, so set a long client timeout.
Errors
| Status | error.code | Why |
|---|---|---|
| 400 | INVALID_REQUEST_BODY | A field is missing or wrong |
| 400 | INVALID_DASHBOARD_ID | No embed of the data app has this dashboard |
| 400 | DATASOURCE_NAME_ERROR or DATAMART_NAME_ERROR | The name is unknown |
| 403 | DATA_APP_ID_ERROR | dataAppId is not the data app of your API token |
| 403 | INVALID_REQUEST_BODY | Databrain refused to render the dashboard for this tenant, for example the dashboard or the workspace is out of scope, or no client can be found. The message tells you why. Do not retry without a change |
| 404 | DATA_APP_NOT_FOUND | No data app in your organization has this id |
| 500 | INTERNAL_SERVER_ERROR | The PDF could not be made, for example dataAppId is not a UUID |
For errors that every endpoint returns, see Authentication.
curl -X POST 'https://api.usedatabrain.com/api/v2/data-app/getDashboardPdf' \ -H 'Content-Type: application/json' \ -d '{ "dataAppId": "7c8d9e0f-1a2b-4c3d-8e4f-5a6b7c8d9e0f", "embedId": "sales-overview", "dashboardId": "sales-overview", "clientId": "acme", "pageSetup": { "orientation": "landscape" }}'"<binary PDF>"