Skip to Content

Embedding API

Fetch metrics by workspace

List the live metrics of a workspace with their ids.

POST
/api/v2/workspace/metrics

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.

Authorization

ApiToken
headerAuthorizationBearer <token>

A service token or a data app API token.

Body

workspaceNamestringrequired

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. 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

Statuserror.codeWhy
400INVALID_REQUEST_BODYworkspaceName is missing, or a field is unknown
400WORKSPACE_ID_ERRORNo workspace has this name

For errors that every endpoint returns, see Authentication.

Example Request
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"    }  ]}