Unlink Workspaces

Unlink client workspaces from the specified master workspace.

REQUEST URI

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

Delete

oauthscope: ZohoAnalytics.modeling.delete

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 unlink.
Supported values:
ALL - Unlinks all the workspaces linked to this master workspace.
SELECTED - Unlinks only the linked workspaces specified in sandboxIds.
The value is case-sensitive and must be in upper case.
Maximum length - 20 characters.

Sample: {"scope":"ALL"}
sandboxIdsJSONArray of String
The sandbox IDs of the linked workspaces to unlink.
Specify each sandbox ID as a string.
Supports 1 to 100 entries.
Maximum length - 5000 characters.
Each sandbox ID must be linked to the master workspace.
This attribute is mandatory when scope is SELECTED, and must not be specified when scope is ALL.

Sample: {"sandboxIds":["137687000012345001","137687000012345002"]}

Note: Unlinking removes only the link between the workspaces. The client workspaces are not deleted.

Sample Request:

Copiedcurl "https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/linkedworkspaces" \
  -X 'DELETE' \
  -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 UnlinkWorkspaces(IAnalyticsClient ac)
        {
            string scope = "ALL";
            IWorkspaceAPI workspace = ac.GetWorkspaceInstance(orgId, workspaceId);
            workspace.UnlinkWorkspaces(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.UnlinkWorkspaces(ac);
        }
    }
}
Copiedpackage main

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

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

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

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

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

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

obj = Sample()
obj.unlink_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.unlinkWorkspaces(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"
  type :DELETE
  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 unlink_workspaces
    scope = "ALL"
    workspace = @ac.get_workspace_instance(Config::ORGID, Config::WORKSPACEID)
    workspace.unlink_workspaces(scope)
    puts "success"
  end
end

obj = Sample.new
obj.unlink_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