Get Alert Configuration
Get the complete configuration of the specified alert.
REQUEST URI
https://<ZohoAnalytics_Server_URI>/restapi/v2/workspaces/<workspace-id>/alerts/<alert-id>
Get
oauthscope: ZohoAnalytics.metadata.read
Sample Request:
Copiedcurl "https://analyticsapi.zoho.com/restapi/v2/workspaces/35130000001055707/alerts/35130000001056611" -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;
long workspaceId = 35130000001055707;
public void GetAlertConfiguration(IAnalyticsClient ac)
{
long alertId = 35130000001056611L;
IWorkspaceAPI workspace = ac.GetWorkspaceInstance(orgId, workspaceId);
JsonElement result = workspace.GetAlertConfiguration(alertId);
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.GetAlertConfiguration(ac);
}
}
}Copiedpackage main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetAlertConfiguration(ac ZAnalytics.Client) {
alertid := "35130000001056611"
workspace := ZAnalytics.GetWorkspaceInstance(&ac, orgId, workspaceId)
result, exception := workspace.GetAlertConfiguration(alertid)
if exception != nil {
fmt.Println(exception.ErrorMessage)
return
}
fmt.Println(result)
}
func main() {
ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
GetAlertConfiguration(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.getAlertConfiguration(ac);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void getAlertConfiguration(AnalyticsClient ac) throws Exception {
long alertId = 35130000001056611l;
WorkspaceAPI workspace = ac.getWorkspaceInstance(orgId, workspaceId);
JSONObject result = workspace.getAlertConfiguration(alertId);
System.out.println(result);
}
}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 getAlertConfiguration() {
$alert_id = "35130000001056611";
$workspace = $this->ac->getWorkspaceInstance($this->org_id, $this->workspace_id);
$response = $workspace->getAlertConfiguration($alert_id);
print_r($response);
}
}
$obj = new Test();
$obj->getAlertConfiguration();
?>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 get_alert_configuration(self, ac):
alert_id = "35130000001056611"
workspace = ac.get_workspace_instance(Config.ORGID, Config.WORKSPACEID)
result = workspace.get_alert_configuration(alert_id)
print(result)
obj = Sample()
obj.get_alert_configuration(obj.ac)Copiedvar analyticsClient = require('./AnalyticsClient');
var ac = new analyticsClient('1000.xxxxxxx', 'xxxxxxx', '1000.xxxxxxx.xxxxxxx');
var orgId = '55522777';
var workspaceId = '35130000001055707';
var alertId = "35130000001056611";
var workspace = ac.getWorkspaceInstance(orgId, workspaceId);
workspace.getAlertConfiguration(alertId).then((result) => { console.log(result); }).catch((error) => { console.log(error); });CopiedorgId = "55522777";
workspaceId = "35130000001055707";
alertId = "35130000001056611";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
response = invokeurl
[
url :"https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/alerts/" + alertId
type :GET
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 get_alert_configuration
alert_id = "35130000001056611"
workspace = @ac.get_workspace_instance(Config::ORGID, Config::WORKSPACEID)
result = workspace.get_alert_configuration(alert_id)
puts result
end
end
obj = Sample.new
obj.get_alert_configurationDownload 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 alert configuration",
"data": {
"alertName": "Sales Drop Alert",
"summaryType": "data",
"isAnomaly": false,
"conditionExpression": "(1)",
"notifyOnChange": false,
"scheduleDetails": {
"timeZone": "Asia/Kolkata",
"calendarFrequency": "daily",
"hour": 9,
"minute": 0,
"interval": 1,
"skipWeekends": true
},
"email": {
"notifyAdmins": true,
"subject": "Sales dropped below threshold",
"message": "Please review the attached report.",
"includeReport": true,
"attachFilteredDataset": false,
"attachmentType": "attachment",
"systemMailId": false,
"emailIds": ["jane.doe@example.com"]
},
"workflows": [
{
"id": "137687000012564035",
"name": "Notify sales channel",
"enabled": true
},
{
"id": "137687000012564054",
"name": "Create follow-up task",
"enabled": false
}
],
"rules": [
{
"operator": "lt",
"viewColumnIndex": "2",
"type": "constant",
"values": ["1000"]
}
]
}
}