Embedding APIs

Retrieve dashboards and metrics from workspaces

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

Name
Type
Description

Authorization*

String

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.

Validation Schema

The request body must conform to the following schema:

  • workspaceName (required): Name of the workspace.

  • isPagination (optional): Boolean flag to enable pagination.

  • pageNumber (optional): Page number when pagination is enabled.

Example Use Cases

Fetching Dashboards

Request

{
  "workspaceName": "SalesWorkspace",
  "isPagination": true,
  "pageNumber": 2
}

Response

{
  "data": [
    {
      "name": "Dashboard 1",
      "externalDashboardId": "12345"
    },
    {
      "name": "Dashboard 2",
      "externalDashboardId": "67890"
    }
  ],
  "error": null
}

Fetching Metrics

Request

{
  "workspaceName": "MarketingWorkspace",
  "isPagination": false
}

Response

{
  "data": [
    {
      "name": "Metric A",
      "metricId": "54321"
    }
  ],
  "error": null
}

Fetch Metrics by Workspace and Dashboard

Endpoint:

POST /dashboard/metrics

Request Body:

{
  "workspaceName": "string",
  "dashboardId": "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
}

Last updated