Data Retrieval
Fetch metrics by embed
List the metrics of an embedded dashboard that one customer can see.
curl "https://api.usedatabrain.com/api/v2/data-app/metrics?embedId=sales-overview&clientId=acme" \ --header "Authorization: Bearer $DATABRAIN_API_TOKEN"Auth
A data app API token. A service token gets 400 INVALID_DATA_APP_API_KEY. See Authentication.
DataAppApiTokenAuthorizationBearer <token>A data app API token. A service token is refused.
Query
The dashboard id of the embed (dashboardId in List embeds). For an embed id with a __ suffix, send the dashboard id without it.
The customer. Metrics a customer made show only to that customer.
Only metrics this user made.
true returns only saved metrics.
true pages the dashboard's metrics, 10 at a time.
Page, from 1
Pages are cut before the filters run, so a page can have fewer than 10 metrics, or none, when later pages have more. Read pages until one is empty.
POST /api/v2/data-app/metrics does the same with the same fields in a JSON body.
Response
{ "data": [ { "externalMetricId": "9d8c7b6a-5f4e-4d3c-8b2a-1f0e9d8c7b6a", "metricId": "b3c4d5e6-f7a8-4b9c-8d0e-1f2a3b4c5d6e", "name": "Monthly revenue", "isPublished": true, "createdByUser": null, "editable": false } ]}| Field | Description |
|---|---|
metricId | The metric id |
externalMetricId | Internal id of the metric row |
isPublished | true for every metric you made. For a customer's metric, whether it is published |
createdByUser | The userIdentifier of the user who made it, or null |
editable | true when this customer made the metric |
Errors
| Status | error.code | Why |
|---|---|---|
| 400 | INVALID_REQUEST_BODY | embedId or clientId is missing or empty |
| 400 | INVALID_DATA_APP_API_KEY | You used a service token |
| 400 | EMBED_PARAM_ERROR | No embed of this data app has this dashboard id |
| 500 | INTERNAL_SERVER_ERROR | The list could not be read |
For errors that every endpoint returns, see Authentication.
curl -X GET 'https://api.usedatabrain.com/api/v2/data-app/metrics?embedId=string&clientId=string'{ "data": [ { "externalMetricId": "9d8c7b6a-5f4e-4d3c-8b2a-1f0e9d8c7b6a", "metricId": "b3c4d5e6-f7a8-4b9c-8d0e-1f2a3b4c5d6e", "name": "Monthly revenue", "isPublished": true, "createdByUser": null, "editable": false } ]}