Skip to Content

Data Retrieval

Fetch metrics by embed

List the metrics of an embedded dashboard that one customer can see.

GET
/api/v2/data-app/metrics
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.

Authorization

DataAppApiToken
headerAuthorizationBearer <token>

A data app API token. A service token is refused.

Query

embedIdstringrequired

The dashboard id of the embed (dashboardId in List embeds). For an embed id with a __ suffix, send the dashboard id without it.

clientIdstringrequired

The customer. Metrics a customer made show only to that customer.

Only metrics this user made.

isMetricstring

true returns only saved metrics.

true pages the dashboard's metrics, 10 at a time.

pageNumberinteger

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    }  ]}
FieldDescription
metricIdThe metric id
externalMetricIdInternal id of the metric row
isPublishedtrue for every metric you made. For a customer's metric, whether it is published
createdByUserThe userIdentifier of the user who made it, or null
editabletrue when this customer made the metric

Errors

Statuserror.codeWhy
400INVALID_REQUEST_BODYembedId or clientId is missing or empty
400INVALID_DATA_APP_API_KEYYou used a service token
400EMBED_PARAM_ERRORNo embed of this data app has this dashboard id
500INTERNAL_SERVER_ERRORThe list could not be read

For errors that every endpoint returns, see Authentication.

Example Request
curl -X GET 'https://api.usedatabrain.com/api/v2/data-app/metrics?embedId=string&clientId=string'
Example Response
{  "data": [    {      "externalMetricId": "9d8c7b6a-5f4e-4d3c-8b2a-1f0e9d8c7b6a",      "metricId": "b3c4d5e6-f7a8-4b9c-8d0e-1f2a3b4c5d6e",      "name": "Monthly revenue",      "isPublished": true,      "createdByUser": null,      "editable": false    }  ]}