Get Linked Workspaces For Organization

Get all the linked workspaces in the specified organization, grouped by master workspace.

REQUEST URI

https://<ZohoAnalytics_Server_URI>/restapi/v2/linkedworkspaces

Get

oauthscope: ZohoAnalytics.metadata.read

Sample Request:

Copiedcurl "https://analyticsapi.zoho.com/restapi/v2/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;

        public void GetLinkedWorkspaces(IAnalyticsClient ac)
        {
            IOrgAPI org = ac.GetOrgInstance(orgId);
            JsonElement result = org.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"
)

func GetLinkedWorkspaces(ac ZAnalytics.Client) {
    org := ZAnalytics.GetOrgInstance(&ac, orgId)
    result, exception := org.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;

    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 {
        OrgAPI org = ac.getOrgInstance(orgId);
        JSONArray result = org.getLinkedWorkspaces();
        System.out.println(result);
    }
}
Copied<?php
require 'AnalyticsClient.php';

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

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

    function getLinkedWorkspaces() {
        $org = $this->ac->getOrgInstance($this->org_id);
        $response = $org->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"

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

    def get_linked_workspaces(self, ac):
        org = ac.get_org_instance(Config.ORGID)
        result = org.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 org = ac.getOrgInstance(orgId);
org.getLinkedWorkspaces().then((result) => { console.log(result); }).catch((error) => { console.log(error); });
CopiedorgId = "55522777";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
response = invokeurl
[
  url :"https://analyticsapi.zoho.com/restapi/v2/linkedworkspaces"
  type :GET
  headers:headersMap
  connection:"analytics_oauth_connection"
];
info response;
Copiedrequire 'zoho_analytics_client'

class Config
  ORGID = "55522777"
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
    org = @ac.get_org_instance(Config::ORGID)
    result = org.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 organization",
    "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": "success",
                                    "syncedBy": "jane.doe@example.com",
                                    "syncedByName": "Jane Doe",
                                    "syncedByZuId": "60002000000000123"
                                },
                                "hasPendingEntities": false
                            },
                            {
                                "workspaceId": "466206000000071010",
                                "workspaceName": "Northwind EU Sandbox",
                                "sandboxId": "137687000012345002",
                                "lastSync": {
                                    "syncTime": "1779140160981",
                                    "syncStatus": "partialSuccess",
                                    "syncedBy": "john.roe@example.com",
                                    "syncedByName": "John Roe",
                                    "syncedByZuId": "60002000000000456"
                                },
                                "hasPendingEntities": true
                            }
                        ]
                    }
                ]
            }
        ]
    }
}