Sync Linked Workspaces

Sync the design of the specified master workspace to its linked client workspaces.

REQUEST URI

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

Post

oauthscope: ZohoAnalytics.modeling.create

QUERY PARAMETERS

 

Parameter Name
Description
CONFIG*JSONObject
Config parameter specifications are available in the below section.

FIELDS FOR CONFIG JSON

 

Key
Description
scope*String
Specifies which linked workspaces to sync.
Supported values:
ALL - Syncs all the workspaces linked to this master workspace.
SELECTED - Syncs only the linked workspaces specified in clients.
The value is case-sensitive and must be in upper case.
Maximum length - 20 characters.

Sample: {"scope":"ALL"}
clientsJSONArray
The sync instructions for each linked workspace.
Supports 1 to 100 entries.
Maximum length - 5000000 characters.
This attribute is mandatory when scope is SELECTED, and must not be specified when scope is ALL.
Check the table clients Sync Fields for more details.

Sample: {"clients":[{"sandboxId":137687000012345001,"scope":"ALL"}]}

clients Sync Fields

 

Key
Description
sandboxId*Long
The sandbox ID of the linked workspace to sync.
Specify the value as a JSON number.
Maximum length - 20 characters.
The sandbox ID must be linked to the master workspace.

Sample: {"sandboxId":137687000012345001}
scope*String
Specifies which entities to sync to this linked workspace.
Supported values:
ALL - Syncs all the eligible entities.
SELECTED - Syncs only the views specified in masterViewIds.
The value is not case-sensitive.
Maximum length - 20 characters.

Sample: {"scope":"SELECTED"}
masterViewIdsJSONArray of String
The IDs of the master workspace views to sync to this linked workspace.
Specify each view ID as a string.
Supports 1 to 1000 entries.
Maximum length - 50000 characters.
This attribute is mandatory when scope is SELECTED, and must not be specified when scope is ALL.

Sample: {"masterViewIds":["137687000006991601","466206000000105001"]}

Note: A single request can include linked workspaces with both ALL and SELECTED scope. Workspaces with SELECTED scope are synced during the request, while workspaces with ALL scope are scheduled and synced afterwards.

Sample Request:

Copiedcurl "https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/linkedworkspaces/sync" \
  -X 'POST' \
  -H 'ZANALYTICS-ORGID: <org-id>' \
  -H 'Authorization: Zoho-oauthtoken <access_token>' \
  --data-urlencode 'CONFIG={"scope":"ALL"}'
Copiedusing System;
using System.Collections.Generic;
using System.Text.Json;
using ZohoAnalytics;

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

        public void SyncLinkedWorkspaces(IAnalyticsClient ac)
        {
            string scope = "ALL";
            IWorkspaceAPI workspace = ac.GetWorkspaceInstance(orgId, workspaceId);
            workspace.SyncLinkedWorkspaces(scope, null);
            Console.WriteLine("success");
        }

        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.SyncLinkedWorkspaces(ac);
        }
    }
}
Copiedpackage main

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

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

func SyncLinkedWorkspaces(ac ZAnalytics.Client) {
    scope := "ALL"
    workspace := ZAnalytics.GetWorkspaceInstance(&ac, orgId, workspaceId)
    exception := workspace.SyncLinkedWorkspaces(scope, nil)
    if exception != nil {
        fmt.Println(exception.ErrorMessage)
        return
    }
    fmt.Println("success")
}

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

    public void syncLinkedWorkspaces(AnalyticsClient ac) throws Exception {
        String scope = "ALL";
        WorkspaceAPI workspace = ac.getWorkspaceInstance(orgId, workspaceId);
        workspace.syncLinkedWorkspaces(scope, null);
        System.out.println("success");
    }
}
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 syncLinkedWorkspaces() {
        $scope = "ALL";
        $workspace = $this->ac->getWorkspaceInstance($this->org_id, $this->workspace_id);
        $workspace->syncLinkedWorkspaces($scope);
        echo "success";
    }
}

$obj = new Test();
$obj->syncLinkedWorkspaces();
?>
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 sync_linked_workspaces(self, ac):
        scope = "ALL"
        workspace = ac.get_workspace_instance(Config.ORGID, Config.WORKSPACEID)
        workspace.sync_linked_workspaces(scope)
        print("success")

obj = Sample()
obj.sync_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 scope = "ALL";
var workspace = ac.getWorkspaceInstance(orgId, workspaceId);
workspace.syncLinkedWorkspaces(scope).then(() => { console.log("success"); }).catch((error) => { console.log(error); });
CopiedorgId = "55522777";
workspaceId = "35130000001055707";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
config = {"scope": "ALL"};
response = invokeurl
parameters = "CONFIG=" + zoho.encryption.urlEncode(config.toString());
[
  url :"https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/linkedworkspaces/sync"
  type :POST
  parameters:parameters
  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 sync_linked_workspaces
    scope = "ALL"
    workspace = @ac.get_workspace_instance(Config::ORGID, Config::WORKSPACEID)
    workspace.sync_linked_workspaces(scope)
    puts "success"
  end
end

obj = Sample.new
obj.sync_linked_workspaces

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

Sample value for CONFIG parameter:

Copied{
  "scope": "ALL"
}

Sample Response:

CopiedHTTP/1.1 204 No Content