Update Org Access Restrictions
Update the organization-level access restriction settings.
REQUEST URI
https://<ZohoAnalytics_Server_URI>/restapi/v2/security-controls/access-restrictions
Put
oauthscope: ZohoAnalytics.metadata.update
QUERY PARAMETERS
| Description |
|---|---|
| CONFIG* | JSONObject Config parameter specifications are available in the below section. |
FIELDS FOR CONFIG JSON
| Description |
|---|---|
| accessRestrictionEnabled | Boolean Controls whether access restriction is enabled for the organization. Supported values: "true", "false" When set to false, no other keys can be specified in the same request. This key is mandatory if no section key is specified. Sample: {"accessRestrictionEnabled":true} |
| shareViews | JSONObject The domain restriction settings applied when views are shared with other users. Maximum length - 30000 characters. Check the table Structure of shareViews for more details. Sample: {"shareViews":{"domainRestrictionEnabled":true,"trustedDomains":["zylker.com","zylker.net"]}} |
| privateLinks | JSONObject The settings of private links (publish links), including their domain restriction. Maximum length - 30000 characters. Check the table Structure of privateLinks, publicViews and emailViews for more details. Sample: {"privateLinks":{"enabled":true,"domainRestrictionEnabled":false}} |
| publicViews | JSONObject The settings of public view sharing, including its domain restriction. Maximum length - 30000 characters. Check the table Structure of privateLinks, publicViews and emailViews for more details. Sample: {"publicViews":{"enabled":false}} |
| exportViews | JSONObject The settings of view export. Maximum length - 100 characters. Check the table Structure of exportViews for more details. Sample: {"exportViews":{"enabled":true}} |
| emailViews | JSONObject The settings of email schedules and data alerts, including their domain restriction. Maximum length - 30000 characters. This key can be specified only when exportViews.enabled is true or is set to true in the same request.Check the table Structure of privateLinks, publicViews and emailViews for more details. Sample: {"emailViews":{"enabled":true,"domainRestrictionEnabled":true,"trustedDomains":["zylker.com"]}} |
Note: Sections that are not specified in CONFIG remain unchanged.
Note: Sections can be updated only when access restriction is enabled for the organization, or is enabled in the same request.
| Description |
|---|---|
| domainRestrictionEnabled | Boolean Controls whether views can be shared only with users of the trusted domains. Supported values: "true", "false" Sample: {"domainRestrictionEnabled":true} |
| trustedDomains | JSONArray The list of trusted domain names. Each entry must be a valid domain name. Maximum entries - 100. Maximum length of each domain - 250 characters. This key is mandatory when domainRestrictionEnabled is enabled for the first time.Sample: {"trustedDomains":["zylker.com","zylker.net"]} |
Note: Trusted domains can be specified only when domainRestrictionEnabled is true or is set to true in the same request.
Note: When domain restriction is enabled, the list of trusted domains must not be empty.
Structure of privateLinks, publicViews and emailViews
| Description |
|---|---|
| enabled | Boolean Controls whether the feature is enabled. privateLinks - Private links (publish links). publicViews - Public view sharing. emailViews - Email schedules and data alerts. Supported values: "true", "false" Sample: {"enabled":true} |
| domainRestrictionEnabled | Boolean Controls whether the feature is restricted to the trusted domains. Supported values: "true", "false" Sample: {"domainRestrictionEnabled":true} |
| trustedDomains | JSONArray The list of trusted domain names. Each entry must be a valid domain name. Maximum entries - 100. Maximum length of each domain - 250 characters. This key is mandatory when domainRestrictionEnabled is enabled for the first time.Sample: {"trustedDomains":["zylker.com"]} |
Note: These three objects share the same structure.
Note: When the feature is disabled and remains disabled, domainRestrictionEnabled and trustedDomains must not be specified.
Note: When the feature is disabled in the same request, domainRestrictionEnabled can only be set to false and trustedDomains can only be an empty array.
Structure of exportViews
| Description |
|---|---|
| enabled* | Boolean Controls whether views can be exported. Supported values: "true", "false" This key is mandatory when exportViews is specified.Sample: {"enabled":true} |
Note: Disabling export also disables email schedules and data alerts (emailViews), even if emailViews is not specified in the request.
Sample Request:
Copiedcurl "https://analyticsapi.zoho.com/restapi/v2/security-controls/access-restrictions" \
-X 'PUT' \
-H 'ZANALYTICS-ORGID: <org-id>' \
-H 'Authorization: Zoho-oauthtoken <access_token>' \
--data-urlencode 'CONFIG={"accessRestrictionEnabled":true}'Copiedusing System;
using System.Collections.Generic;
using System.Text.Json;
using ZohoAnalytics;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777;
public void UpdateOrgAccessRestrictions(IAnalyticsClient ac)
{
Dictionary<string, object> config = JsonSerializer.Deserialize<Dictionary<string, object>>("{\"accessRestrictionEnabled\":true}");
IOrgAPI org = ac.GetOrgInstance(orgId);
org.UpdateOrgAccessRestrictions(config);
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.UpdateOrgAccessRestrictions(ac);
}
}
}Copiedpackage main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func UpdateOrgAccessRestrictions(ac ZAnalytics.Client) {
config := map[string]interface{}{
"accessRestrictionEnabled": true,
}
org := ZAnalytics.GetOrgInstance(&ac, orgId)
exception := org.UpdateOrgAccessRestrictions(config)
if exception != nil {
fmt.Println(exception.ErrorMessage)
return
}
fmt.Println("success")
}
func main() {
ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
UpdateOrgAccessRestrictions(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.updateOrgAccessRestrictions(ac);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void updateOrgAccessRestrictions(AnalyticsClient ac) throws Exception {
JSONObject config = new JSONObject("{\"accessRestrictionEnabled\":true}");
OrgAPI org = ac.getOrgInstance(orgId);
org.updateOrgAccessRestrictions(config);
System.out.println("success");
}
}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 updateOrgAccessRestrictions() {
$config = array(
"accessRestrictionEnabled" => true
);
$org = $this->ac->getOrgInstance($this->org_id);
$org->updateOrgAccessRestrictions($config);
echo "success";
}
}
$obj = new Test();
$obj->updateOrgAccessRestrictions();
?>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 update_org_access_restrictions(self, ac):
config = {
"accessRestrictionEnabled": True
}
org = ac.get_org_instance(Config.ORGID)
org.update_org_access_restrictions(config)
print("success")
obj = Sample()
obj.update_org_access_restrictions(obj.ac)Copiedvar analyticsClient = require('./AnalyticsClient');
var ac = new analyticsClient('1000.xxxxxxx', 'xxxxxxx', '1000.xxxxxxx.xxxxxxx');
var orgId = '55522777';
var config = {
"accessRestrictionEnabled": true
};
var org = ac.getOrgInstance(orgId);
org.updateOrgAccessRestrictions(config).then(() => { console.log("success"); }).catch((error) => { console.log(error); });CopiedorgId = "55522777";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
config = {"accessRestrictionEnabled": true};
response = invokeurl
parameters = "CONFIG=" + zoho.encryption.urlEncode(config.toString());
[
url :"https://analyticsapi.zoho.com/restapi/v2/security-controls/access-restrictions"
type :PUT
parameters:parameters
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 update_org_access_restrictions
config = {
"accessRestrictionEnabled" => true
}
org = @ac.get_org_instance(Config::ORGID)
org.update_org_access_restrictions(config)
puts "success"
end
end
obj = Sample.new
obj.update_org_access_restrictionsDownload client libraries: C# | GO | JAVA | PHP | PYTHON | NodeJS | Ruby
Sample value for CONFIG parameter:
Copied{
"accessRestrictionEnabled": true
}Sample Response:
CopiedHTTP/1.1 204 No Content