đŸ› ī¸
Developer docs
Start BuildingGuides
  • ✨Getting Started
  • đŸŽ›ī¸Self Hosted Config
  • âœī¸SSO Login
    • Saml Identity Provider (Idp)
    • Oidc Identity Provider (Idp)
  • đŸŽžī¸Framework Specific Guide
    • âš›ī¸Reactjs
    • âš›ī¸Nextjs
    • âš›ī¸Vuejs
    • âš›ī¸Angular
    • âš›ī¸Svelte
    • âš›ī¸Solid
    • âš›ī¸Vanilla JS
  • â„šī¸Token
  • đŸ›ī¸Multi-Tenant Access Control
  • Embed using iFrame
  • 🔑License Key Validation for Self-Hosted App
  • Test
  • 👩‍đŸ’ģHelpers
    • âœŗī¸Token Body
    • ✅Options
      • Custom Fiscal Year filter setup in DataBrain
    • đŸˆ‚ī¸Server Event
    • Embed Functions
    • Override Language
    • âœˆī¸Embedding Architecture
    • âœˆī¸LLM Architecture
    • ✨LLM Connectors
      • Open AI
      • Claude AI
      • Azure Open AI
      • Llama
      • Mixtral
    • 🆔Dashboard ID
    • 🆔Metric ID
    • 🆔API Token
    • 🆔End User Metric Creation
    • Embedding APIs
      • Sync Datasource
  • Metric App Filter
  • Dashboard App Filter
  • Chat Mode
    • Step 1: Create Datamart and Workspace
    • Step 2: Create Data App and Embed ID
  • ✨Solutions Alchemy
    • Dashboards for Client Groups
    • Dashboard for Multiple Clients
    • Embedding: Role based Dashboard Filtering
    • Localized Currency Symbols
    • Manage Metrics
Powered by GitBook
On this page
  • Overview
  • API Endpoints
  • Cloud Databrain Endpoint
  • Self-hosted Databrain Endpoint
  • API Methods
  • Fetch Dashboards by Workspace
  • Fetch Metrics by Workspace
  • Error Codes
  • Validation Schema
  • Example Use Cases
  • Fetch Metrics by Workspace and Dashboard
  1. Helpers

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

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
}

PreviousEnd User Metric CreationNextSync Datasource

Last updated 2 months ago

Bearer

👩‍đŸ’ģ
API TOKEN