Read Dashboard Metadata

Get the metadata of the specified dashboard, including its layout, settings and theme details.

REQUEST URI

https://<ZohoAnalytics_Server_URI>/restapi/v2/workspaces/<workspace-id>/dashboards/<dashboard-id>/metadata

Get

oauthscope: ZohoAnalytics.modeling.read

QUERY PARAMETERS

 

Parameter Name
Description
CONFIGJSONObject
Config parameter specifications are available in the below section.

FIELDS FOR CONFIG JSON

 

Key
Description
includeString
The section of the dashboard metadata to return.
Supported values: "all", "layout", "themes", "settings"
If CONFIG is not specified, all sections are returned.

Sample: {"include":"layout"}

Sample Request:

Copiedcurl -G "https://analyticsapi.zoho.com/restapi/v2/workspaces/35130000001055707/dashboards/35130000001055801/metadata" --data-urlencode 'CONFIG={"include":"layout"}' -H 'ZANALYTICS-ORGID: <org-id>' -H 'Authorization: Zoho-oauthtoken <access_token>'
Copiedusing System;
using System.Collections.Generic;
using System.Text.Json;
using ZohoAnalytics;

namespace ZohoAnalyticsTest
{
    class Program
    {
        long orgId = 55522777;
        long workspaceId = 35130000001055707;

        public void GetDashboardMetadata(IAnalyticsClient ac)
        {
            long dashboardId = 35130000001055801L;
            Dictionary<string, object> config = JsonSerializer.Deserialize<Dictionary<string, object>>("{\"include\":\"layout\"}");
            IWorkspaceAPI workspace = ac.GetWorkspaceInstance(orgId, workspaceId);
            JsonElement result = workspace.GetDashboardMetadata(dashboardId, config);
            Console.WriteLine(result);
        }

        static void Main(string[] args)
        {
            string clientId = "1000.xxxxxxx";
            string clientSecret = "xxxxxxx";
            string refreshToken = "1000.xxxxxxx.xxxxxxx";
            IAnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);
            Program obj = new Program();
            obj.GetDashboardMetadata(ac);
        }
    }
}
Copiedpackage main

import (
    "fmt"
    ZAnalytics "zoho/pkg/analyticsclient"
)

var (
    clientId = "1000.xxxxxxx"
    clientSecret = "xxxxxxx"
    refreshToken = "1000.xxxxxxx.xxxxxxx"
    orgId = "55522777"
    workspaceId = "35130000001055707"
)

func GetDashboardMetadata(ac ZAnalytics.Client) {
    dashboardid := "35130000001055801"
    config := map[string]interface{}{
        "include": "layout",
    }
    workspace := ZAnalytics.GetWorkspaceInstance(&ac, orgId, workspaceId)
    result, exception := workspace.GetDashboardMetadata(dashboardid, config)
    if exception != nil {
        fmt.Println(exception.ErrorMessage)
        return
    }
    fmt.Println(result)
}

func main() {
    ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
    GetDashboardMetadata(ac)
}
Copiedimport com.zoho.analytics.client.*;
import org.json.*;

public class Test {
    private long orgId = 55522777l;
    private long workspaceId = 35130000001055707l;

    public static void main(String args[]) {
        String clientId = "1000.xxxxxxx";
        String clientSecret = "xxxxxxx";
        String refreshToken = "1000.xxxxxxx.xxxxxxx";
        Test tObj = new Test();
        AnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);
        try {
            tObj.getDashboardMetadata(ac);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public void getDashboardMetadata(AnalyticsClient ac) throws Exception {
        long dashboardId = 35130000001055801l;
        JSONObject config = new JSONObject("{\"include\":\"layout\"}");
        WorkspaceAPI workspace = ac.getWorkspaceInstance(orgId, workspaceId);
        JSONObject result = workspace.getDashboardMetadata(dashboardId, config);
        System.out.println(result);
    }
}
Copied<?php
require 'AnalyticsClient.php';

class Test {
    public $ac;
    public $org_id = "55522777";
    public $workspace_id = "35130000001055707";

    function __construct() {
        $this->ac = new AnalyticsClient("1000.xxxxxxx", "xxxxxxx", "1000.xxxxxxx.xxxxxxx");
    }

    function getDashboardMetadata() {
        $dashboard_id = "35130000001055801";
        $config = array(
            "include" => "layout"
        );
        $workspace = $this->ac->getWorkspaceInstance($this->org_id, $this->workspace_id);
        $response = $workspace->getDashboardMetadata($dashboard_id, $config);
        print_r($response);
    }
}

$obj = new Test();
$obj->getDashboardMetadata();
?>
Copiedfrom AnalyticsClient import AnalyticsClient

class Config:
    CLIENTID = "1000.xxxxxxx"
    CLIENTSECRET = "xxxxxxx"
    REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx"
    ORGID = "55522777"
    WORKSPACEID = "35130000001055707"

class Sample:
    ac = AnalyticsClient(Config.CLIENTID, Config.CLIENTSECRET, Config.REFRESHTOKEN)

    def get_dashboard_metadata(self, ac):
        dashboard_id = "35130000001055801"
        config = {
            "include": "layout"
        }
        workspace = ac.get_workspace_instance(Config.ORGID, Config.WORKSPACEID)
        result = workspace.get_dashboard_metadata(dashboard_id, config)
        print(result)

obj = Sample()
obj.get_dashboard_metadata(obj.ac)
Copiedvar analyticsClient = require('./AnalyticsClient');
var ac = new analyticsClient('1000.xxxxxxx', 'xxxxxxx', '1000.xxxxxxx.xxxxxxx');
var orgId = '55522777';
var workspaceId = '35130000001055707';

var dashboardId = "35130000001055801";
var config = {
    "include": "layout"
};
var workspace = ac.getWorkspaceInstance(orgId, workspaceId);
workspace.getDashboardMetadata(dashboardId, config).then((result) => { console.log(result); }).catch((error) => { console.log(error); });
CopiedorgId = "55522777";
workspaceId = "35130000001055707";
dashboardId = "35130000001055801";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
// Omit CONFIG to return every section; include names exactly one of all, layout, themes, settings
config = Map();
config.put("include", "layout");
parameters = "CONFIG=" + zoho.encryption.urlEncode(config.toString());
response = invokeurl
[
  url :"https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/dashboards/" + dashboardId + "/metadata?" + parameters
  type :GET
  headers:headersMap
  connection:"analytics_oauth_connection"
];
info response;
Copiedrequire 'zoho_analytics_client'

class Config
  ORGID = "55522777"
  WORKSPACEID = "35130000001055707"
end

class Sample
  def initialize
    @ac = AnalyticsClient.new.with_data_center("US").with_oauth({
      "clientId" => "1000.xxxxxxx",
      "clientSecret" => "xxxxxxx",
      "refreshToken" => "1000.xxxxxxx.xxxxxxx"
    }).build
  end

  def get_dashboard_metadata
    dashboard_id = "35130000001055801"
    config = {
      "include" => "layout"
    }
    workspace = @ac.get_workspace_instance(Config::ORGID, Config::WORKSPACEID)
    result = workspace.get_dashboard_metadata(dashboard_id, config)
    puts result
  end
end

obj = Sample.new
obj.get_dashboard_metadata

Download client libraries:  C# | GO | JAVA | PHP | PYTHON | NodeJS | Ruby

Sample value for CONFIG parameter:

Copied{
  "include": "layout"
}

Sample Response:

CopiedHTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8

{
  "status": "success",
  "summary": "Read dashboard metadata",
  "data": {
    "displayName": "Sales Overview",
    "layout": {
      "1": { "type": "USERFILTERS", "width": 80, "height": 3, "left": 0, "top": 0 },
      "2": { "type": "HTML", "width": 80, "height": 5, "left": 0, "top": 3, "content": "<b>Sales Dashboard</b>" },
      "3": { "type": "VIEW", "width": 80, "height": 20, "left": 0, "top": 8, "viewName": "Sales Chart", "properties": {} }
    },
    "settings": {
      "allowDrillDown": "true",
      "fitToWidth": "true",
      "allowExport": { "csv": "true", "pdf": "true" }
    },
    "themes": {
      "layoutType": 2,
      "type": "solid",
      "solid": { "background": "#333542" },
      "card": {
        "background": "#3E3F4D",
        "title": { "border": { "color": "#6F738E" } },
        "border": { "color": "#6F738E", "width": 2 }
      }
    }
  }
}