Embedding API
Fetch metrics by workspace
List the live metrics of a workspace with their ids.
POST
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.
ApiTokenheader
AuthorizationBearer <token>A service token or a data app API token.
Body
The workspace.
isPaginationboolean
true returns up to 10 metrics per page. Send a JSON boolean.
pageNumbernumber
Page, from 1
A page can have fewer than 10 metrics when there are more pages. Stop when a page is empty.
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}'Example Response
{ "data": [ { "name": "Monthly revenue", "metricId": "b3c4d5e6-f7a8-4b9c-8d0e-1f2a3b4c5d6e" } ]}