Embedding API
Fetch metrics by workspace
List the live metrics of a workspace with their ids.
The list has every live metric of the workspace and of its dashboards. Archived metrics, and the copies made for customer dashboards, are left out.
curl --request POST https://api.usedatabrain.com/api/v2/workspace/metrics \ --header "Authorization: Bearer $DATABRAIN_SERVICE_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "workspaceName": "Customer analytics", "isPagination": true, "pageNumber": 1 }'Auth
A service token. See Authentication.
ApiTokenAuthorizationBearer <token>A service token or a data app API token.
Body
The workspace.
true returns up to 10 metrics per page. Send a JSON boolean.
Page, from 1
A page can have fewer than 10 metrics when there are more pages. When the workspace has many customer copies, a page can also be empty before the end. To get every metric, leave out isPagination.
Response
{ "data": [ { "name": "Monthly revenue", "metricId": "b3c4d5e6-f7a8-4b9c-8d0e-1f2a3b4c5d6e" } ]}Metrics your customers made are in the list. The order is not fixed.
Errors
| Status | error.code | Why |
|---|---|---|
| 400 | INVALID_REQUEST_BODY | workspaceName is missing, or a field is unknown |
| 400 | WORKSPACE_ID_ERROR | No workspace has this name |
For errors that every endpoint returns, see Authentication.
curl -X POST 'https://api.usedatabrain.com/api/v2/workspace/metrics' \ -H 'Content-Type: application/json' \ -d '{ "workspaceName": "Customer analytics", "isPagination": true, "pageNumber": 1}'{ "data": [ { "name": "Monthly revenue", "metricId": "b3c4d5e6-f7a8-4b9c-8d0e-1f2a3b4c5d6e" } ]}