{
  "workspaceName": "string",
  "isPagination": "boolean (optional)",
  "pageNumber": "number (optional)"
}
{
  "data": [
    {
      "name": "string",
      "externalDashboardId": "string"
    }
  ],
  "error": null
}

Overview

The Databrain API provides endpoints for retrieving dashboards and metrics from workspaces in both Cloud Databrain and self-hosted Databrain environments. To use the API, you need to pass a workspaceName along with other optional parameters.

API Endpoints

Cloud Databrain Endpoint

POST https://api.usedatabrain.com/api/v2/workspace/dashboards

Self-hosted Databrain Endpoint

POST <SELF_HOSTED_URL>/api/v2/workspace/dashboards

Headers

Authorization
string
required
Bearer API TOKEN

API Methods

Fetch Dashboards by Workspace

Endpoint:
POST /dashboards
Request Body:
{
  "workspaceName": "string",
  "isPagination": "boolean (optional)",
  "pageNumber": "number (optional)"
}
Response:
{
  "data": [
    {
      "name": "string",
      "externalDashboardId": "string"
    }
  ],
  "error": null
}
Error Response:
{
  "error": {
    "code": "string",
    "message": "string",
    "status": 400
  }
}

Fetch Metrics by Workspace

Endpoint:
POST /metrics
Request Body:
{
  "workspaceName": "string",
  "isPagination": "boolean (optional)",
  "pageNumber": "number (optional)"
}
Response:
{
  "data": [
    {
      "name": "string",
      "metricId": "string"
    }
  ],
  "error": null
}
Error Response:
{
  "error": {
    "code": "string",
    "message": "string",
    "status": 400
  }
}

Error Codes

  • INVALID_REQUEST_BODY: The request body is invalid.
  • WORKSPACE_ID_ERROR: The workspace name provided does not exist.
  • DASHBOARD_PARAM_ERROR: The provided dashboardId is not valid or does not exist in the given workspace.

Validation Schema

The request body must conform to the following schema:
  • workspaceName (required): Name of the workspace.
  • dashboardId (required): Dashboard identifier.
  • isPagination (optional): Boolean flag to enable pagination.
  • pageNumber (optional): Page number when pagination is enabled.

Example Use Cases

Fetching Metrics by Workspace and Dashboard

Request:
{
  "workspaceName": "FinanceWorkspace",
  "dashboardId": "98765",
  "isPagination": true,
  "pageNumber": 1
}
Response:
{
  "data": [
    {
      "name": "Revenue Metric",
      "metricId": "r123"
    },
    {
      "name": "Expense Metric",
      "metricId": "e456"
    }
  ],
  "error": null
}