Get Workspace Access Restrictions

Get the effective access restriction settings of the specified workspace, including whether they are inherited from the organization.

REQUEST URI

https://<ZohoAnalytics_Server_URI>/restapi/v2/security-controls/workspaces/<workspace-id>/access-restrictions

Get

oauthscope: ZohoAnalytics.metadata.read

Sample Request:

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

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

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

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

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

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

$obj = new Test();
$obj->getWorkspaceAccessRestrictions();
?>
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_workspace_access_restrictions(self, ac):
        workspace_id = "35130000001055707"
        workspace = ac.get_workspace_instance(Config.ORGID, workspace_id)
        result = workspace.get_workspace_access_restrictions()
        print(result)

obj = Sample()
obj.get_workspace_access_restrictions(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.getWorkspaceAccessRestrictions().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/security-controls/workspaces/" + workspaceId + "/access-restrictions"
  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_workspace_access_restrictions
    workspace_id = "35130000001055707"
    workspace = @ac.get_workspace_instance(Config::ORGID, workspace_id)
    result = workspace.get_workspace_access_restrictions
    puts result
  end
end

obj = Sample.new
obj.get_workspace_access_restrictions

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 workspace access restrictions",
  "data": {
    "accessRestrictionEnabled": true,
    "configurationSource": "WORKSPACE",
    "shareViews": {
      "domainRestrictionEnabled": true,
      "trustedDomains": ["zylker.com"]
    },
    "privateLinks": {
      "enabled": false,
      "domainRestrictionEnabled": false,
      "trustedDomains": []
    },
    "publicViews": {
      "enabled": false,
      "domainRestrictionEnabled": false,
      "trustedDomains": []
    },
    "exportViews": {
      "enabled": true
    },
    "emailViews": {
      "enabled": true,
      "domainRestrictionEnabled": false,
      "trustedDomains": []
    }
  }
}