Get Linked Workspaces For Master Workspace

Get the client workspaces linked to the specified master workspace.

REQUEST URI

https://<ZohoAnalytics_Server_URI>/restapi/v2/workspaces/<workspace-id>/linkedworkspaces

Get

oauthscope: ZohoAnalytics.metadata.read

Sample Request:

Copiedcurl "https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/linkedworkspaces" \
  -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 GetLinkedWorkspaces(IAnalyticsClient ac)
        {
            IWorkspaceAPI workspace = ac.GetWorkspaceInstance(orgId, workspaceId);
            JsonElement result = workspace.GetLinkedWorkspaces();
            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.GetLinkedWorkspaces(ac);
        }
    }
}
Copiedpackage main

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

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

func GetLinkedWorkspaces(ac ZAnalytics.Client) {
    workspace := ZAnalytics.GetWorkspaceInstance(&ac, orgId, workspaceId)
    result, exception := workspace.GetLinkedWorkspaces()
    if exception != nil {
        fmt.Println(exception.ErrorMessage)
        return
    }
    fmt.Println(result)
}

func main() {
    ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
    GetLinkedWorkspaces(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.getLinkedWorkspaces(ac);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public void getLinkedWorkspaces(AnalyticsClient ac) throws Exception {
        WorkspaceAPI workspace = ac.getWorkspaceInstance(orgId, workspaceId);
        JSONArray result = workspace.getLinkedWorkspaces();
        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 getLinkedWorkspaces() {
        $workspace = $this->ac->getWorkspaceInstance($this->org_id, $this->workspace_id);
        $response = $workspace->getLinkedWorkspaces();
        print_r($response);
    }
}

$obj = new Test();
$obj->getLinkedWorkspaces();
?>
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_linked_workspaces(self, ac):
        workspace = ac.get_workspace_instance(Config.ORGID, Config.WORKSPACEID)
        result = workspace.get_linked_workspaces()
        print(result)

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

var workspace = ac.getWorkspaceInstance(orgId, workspaceId);
workspace.getLinkedWorkspaces().then((result) => { console.log(result); }).catch((error) => { console.log(error); });
CopiedorgId = "55522777";
workspaceId = "35130000001055707";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
response = invokeurl
[
  url :"https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/linkedworkspaces"
  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_linked_workspaces
    workspace = @ac.get_workspace_instance(Config::ORGID, Config::WORKSPACEID)
    result = workspace.get_linked_workspaces
    puts result
  end
end

obj = Sample.new
obj.get_linked_workspaces

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

Sample Response:

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

{
    "status": "success",
    "summary": "Get linked workspaces for master workspace",
    "data": {
        "linkedWorkspaces": {
            "master": {
                "workspaceId": "137687000271334001",
                "workspaceName": "ISV Master Analytics",
                "orgId": "700000123456",
                "orgName": "Zylker Analytics"
            },
            "clients": [
                {
                    "orgId": "700000654321",
                    "orgName": "Northwind Retail",
                    "workspaces": [
                        {
                            "workspaceId": "466206000000071000",
                            "workspaceName": "Northwind Sandbox",
                            "sandboxId": "137687000012345001",
                            "lastSync": {
                                "syncTime": "1779226560981",
                                "syncStatus": "partialSuccess",
                                "syncedBy": "jane.doe@example.com",
                                "syncedByName": "Jane Doe",
                                "syncedByZuId": "60002000000000123"
                            },
                            "hasPendingEntities": true
                        }
                    ]
                },
                {
                    "orgId": "700000999999",
                    "orgName": "Contoso Distribution",
                    "workspaces": [
                        {
                            "workspaceId": "466206000000081010",
                            "workspaceName": "Contoso Sandbox",
                            "sandboxId": "137687000012345003",
                            "lastSync": {
                                "syncTime": "0",
                                "syncStatus": "inProgress",
                                "syncedBy": "john.roe@example.com",
                                "syncedByName": "John Roe",
                                "syncedByZuId": "60002000000000456"
                            },
                            "hasPendingEntities": true
                        }
                    ]
                }
            ]
        }
    }
}