Run Alert
Run the specified alert immediately.
REQUEST URI
https://<ZohoAnalytics_Server_URI>/restapi/v2/workspaces/<workspace-id>/alerts/<alert-id>/execute
Post
oauthscope: ZohoAnalytics.modeling.create
QUERY PARAMETERS
| Description |
|---|---|
| CONFIG | JSONObject Config parameter specifications are available in the below section. |
FIELDS FOR CONFIG JSON
| Description |
|---|---|
| validateSystemTags | Boolean Controls whether the Data Warning system tags of the view are validated before the alert is run. When true and the alert attaches the report to an email from a view that has a restricted Data Warning tag, the alert is not run. Set it to false to skip the validation. This attribute has no effect when the alert does not attach the report. Supported values: "true", "false" Default value - true. Sample: {"validateSystemTags":false} |
Note: This API queues the alert for evaluation. If the alert condition is met, notifications are sent through all the configured channels. Use the Get Alert Events API to check the outcome.
Sample Request:
Copiedcurl "https://analyticsapi.zoho.com/restapi/v2/workspaces/35130000001055707/alerts/35130000001056611/execute" -X 'POST' -H 'ZANALYTICS-ORGID: <org-id>' -H 'Authorization: Zoho-oauthtoken <access_token>' --data-urlencode 'CONFIG={"validateSystemTags":false}'Copiedusing System;
using System.Collections.Generic;
using System.Text.Json;
using ZohoAnalytics;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777;
long workspaceId = 35130000001055707;
public void RunAlert(IAnalyticsClient ac)
{
long alertId = 35130000001056611L;
Dictionary<string, object> config = JsonSerializer.Deserialize<Dictionary<string, object>>("{\"validateSystemTags\":false}");
IWorkspaceAPI workspace = ac.GetWorkspaceInstance(orgId, workspaceId);
workspace.RunAlert(alertId, 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.RunAlert(ac);
}
}
}Copiedpackage main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RunAlert(ac ZAnalytics.Client) {
alertid := "35130000001056611"
config := map[string]interface{}{
"validateSystemTags": false,
}
workspace := ZAnalytics.GetWorkspaceInstance(&ac, orgId, workspaceId)
exception := workspace.RunAlert(alertid, config)
if exception != nil {
fmt.Println(exception.ErrorMessage)
return
}
fmt.Println("success")
}
func main() {
ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
RunAlert(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.runAlert(ac);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void runAlert(AnalyticsClient ac) throws Exception {
long alertId = 35130000001056611l;
JSONObject config = new JSONObject("{\"validateSystemTags\":false}");
WorkspaceAPI workspace = ac.getWorkspaceInstance(orgId, workspaceId);
workspace.runAlert(alertId, config);
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 runAlert() {
$alert_id = "35130000001056611";
$config = array(
"validateSystemTags" => false
);
$workspace = $this->ac->getWorkspaceInstance($this->org_id, $this->workspace_id);
$workspace->runAlert($alert_id, $config);
echo "success";
}
}
$obj = new Test();
$obj->runAlert();
?>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 run_alert(self, ac):
alert_id = "35130000001056611"
config = {
"validateSystemTags": False
}
workspace = ac.get_workspace_instance(Config.ORGID, Config.WORKSPACEID)
workspace.run_alert(alert_id, config)
print("success")
obj = Sample()
obj.run_alert(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 config = {
"validateSystemTags": false
};
var workspace = ac.getWorkspaceInstance(orgId, workspaceId);
workspace.runAlert(alertId, config).then(() => { console.log("success"); }).catch((error) => { console.log(error); });CopiedorgId = "55522777";
workspaceId = "35130000001055707";
alertId = "35130000001056611";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
config = {"validateSystemTags": false};
response = invokeurl
parameters = "CONFIG=" + zoho.encryption.urlEncode(config.toString());
[
url :"https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/alerts/" + alertId + "/execute"
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 run_alert
alert_id = "35130000001056611"
config = {
"validateSystemTags" => false
}
workspace = @ac.get_workspace_instance(Config::ORGID, Config::WORKSPACEID)
workspace.run_alert(alert_id, config)
puts "success"
end
end
obj = Sample.new
obj.run_alertDownload client libraries: C# | GO | JAVA | PHP | PYTHON | NodeJS | Ruby
Sample value for CONFIG parameter:
Copied{
"validateSystemTags": false
}Sample Response:
CopiedHTTP/1.1 204 No Content