curl --request PUT \
--url http://10.2.4.166:8080/composer/api/alerts/{id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/vnd.composer.v3+json' \
--data '
{
"name": "Alert name",
"schedule": {
"minutesOfHour": 15,
"dayOfMonth": 1,
"daysOfWeek": [],
"monthsOfYear": "[JANUARY] or [MAY, DECEMBER]",
"timeOfDay": "17:30:00",
"startTimeOfDay": "16:00:00",
"endTimeOfDay": "18:00:00",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"timezone": "America/New_York"
},
"condition": {
"sourceId": "<string>",
"dataQuery": {
"cid": "<string>",
"excludeResults": true,
"queryDerivedFields": [
{
"name": "<string>",
"expression": "<string>"
}
],
"filters": [
{
"path": {
"name": "<string>"
},
"value": "<unknown>"
}
],
"fields": [
{
"name": "<string>",
"expression": "<string>"
}
],
"distinct": true,
"sorts": [
{
"field": {
"field": {
"name": "<string>"
}
}
}
],
"offset": 123,
"limit": 123,
"excludeNulls": true,
"postProcessingRawExpressions": [
{
"name": "<string>",
"expression": {
"path": {
"name": "<string>"
},
"value": "<unknown>"
}
}
],
"referencedQueryCid": "<string>"
},
"timeFilter": {
"timeField": "<string>",
"from": "<string>",
"to": "<string>"
}
},
"notification": {
"subject": "<string>",
"recipients": {
"users": [
{
"id": 11111,
"name": "john_doe"
}
]
},
"body": "<string>",
"redirectUrl": "<string>"
},
"id": "<string>",
"dashboards": [
{
"id": "00000",
"name": "Total Sales Dashboard"
}
],
"description": "Alert description",
"enabled": true,
"notification ": {}
}
'import requests
url = "http://10.2.4.166:8080/composer/api/alerts/{id}"
payload = {
"name": "Alert name",
"schedule": {
"minutesOfHour": 15,
"dayOfMonth": 1,
"daysOfWeek": [],
"monthsOfYear": "[JANUARY] or [MAY, DECEMBER]",
"timeOfDay": "17:30:00",
"startTimeOfDay": "16:00:00",
"endTimeOfDay": "18:00:00",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"timezone": "America/New_York"
},
"condition": {
"sourceId": "<string>",
"dataQuery": {
"cid": "<string>",
"excludeResults": True,
"queryDerivedFields": [
{
"name": "<string>",
"expression": "<string>"
}
],
"filters": [
{
"path": { "name": "<string>" },
"value": "<unknown>"
}
],
"fields": [
{
"name": "<string>",
"expression": "<string>"
}
],
"distinct": True,
"sorts": [{ "field": { "field": { "name": "<string>" } } }],
"offset": 123,
"limit": 123,
"excludeNulls": True,
"postProcessingRawExpressions": [
{
"name": "<string>",
"expression": {
"path": { "name": "<string>" },
"value": "<unknown>"
}
}
],
"referencedQueryCid": "<string>"
},
"timeFilter": {
"timeField": "<string>",
"from": "<string>",
"to": "<string>"
}
},
"notification": {
"subject": "<string>",
"recipients": { "users": [
{
"id": 11111,
"name": "john_doe"
}
] },
"body": "<string>",
"redirectUrl": "<string>"
},
"id": "<string>",
"dashboards": [
{
"id": "00000",
"name": "Total Sales Dashboard"
}
],
"description": "Alert description",
"enabled": True,
"notification ": {}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/vnd.composer.v3+json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/vnd.composer.v3+json'
},
body: JSON.stringify({
name: 'Alert name',
schedule: {
minutesOfHour: 15,
dayOfMonth: 1,
daysOfWeek: [],
monthsOfYear: '[JANUARY] or [MAY, DECEMBER]',
timeOfDay: '17:30:00',
startTimeOfDay: '16:00:00',
endTimeOfDay: '18:00:00',
startDate: '2023-12-25',
endDate: '2023-12-25',
timezone: 'America/New_York'
},
condition: {
sourceId: '<string>',
dataQuery: {
cid: '<string>',
excludeResults: true,
queryDerivedFields: [{name: '<string>', expression: '<string>'}],
filters: [{path: {name: '<string>'}, value: '<unknown>'}],
fields: [{name: '<string>', expression: '<string>'}],
distinct: true,
sorts: [{field: {field: {name: '<string>'}}}],
offset: 123,
limit: 123,
excludeNulls: true,
postProcessingRawExpressions: [{name: '<string>', expression: {path: {name: '<string>'}, value: '<unknown>'}}],
referencedQueryCid: '<string>'
},
timeFilter: {timeField: '<string>', from: '<string>', to: '<string>'}
},
notification: {
subject: '<string>',
recipients: {users: [{id: 11111, name: 'john_doe'}]},
body: JSON.stringify('<string>'),
redirectUrl: '<string>'
},
id: '<string>',
dashboards: [{id: '00000', name: 'Total Sales Dashboard'}],
description: 'Alert description',
enabled: true,
'notification ': {}
})
};
fetch('http://10.2.4.166:8080/composer/api/alerts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://10.2.4.166:8080/composer/api/alerts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Alert name',
'schedule' => [
'minutesOfHour' => 15,
'dayOfMonth' => 1,
'daysOfWeek' => [
],
'monthsOfYear' => '[JANUARY] or [MAY, DECEMBER]',
'timeOfDay' => '17:30:00',
'startTimeOfDay' => '16:00:00',
'endTimeOfDay' => '18:00:00',
'startDate' => '2023-12-25',
'endDate' => '2023-12-25',
'timezone' => 'America/New_York'
],
'condition' => [
'sourceId' => '<string>',
'dataQuery' => [
'cid' => '<string>',
'excludeResults' => true,
'queryDerivedFields' => [
[
'name' => '<string>',
'expression' => '<string>'
]
],
'filters' => [
[
'path' => [
'name' => '<string>'
],
'value' => '<unknown>'
]
],
'fields' => [
[
'name' => '<string>',
'expression' => '<string>'
]
],
'distinct' => true,
'sorts' => [
[
'field' => [
'field' => [
'name' => '<string>'
]
]
]
],
'offset' => 123,
'limit' => 123,
'excludeNulls' => true,
'postProcessingRawExpressions' => [
[
'name' => '<string>',
'expression' => [
'path' => [
'name' => '<string>'
],
'value' => '<unknown>'
]
]
],
'referencedQueryCid' => '<string>'
],
'timeFilter' => [
'timeField' => '<string>',
'from' => '<string>',
'to' => '<string>'
]
],
'notification' => [
'subject' => '<string>',
'recipients' => [
'users' => [
[
'id' => 11111,
'name' => 'john_doe'
]
]
],
'body' => '<string>',
'redirectUrl' => '<string>'
],
'id' => '<string>',
'dashboards' => [
[
'id' => '00000',
'name' => 'Total Sales Dashboard'
]
],
'description' => 'Alert description',
'enabled' => true,
'notification ' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/vnd.composer.v3+json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://10.2.4.166:8080/composer/api/alerts/{id}"
payload := strings.NewReader("{\n \"name\": \"Alert name\",\n \"schedule\": {\n \"minutesOfHour\": 15,\n \"dayOfMonth\": 1,\n \"daysOfWeek\": [],\n \"monthsOfYear\": \"[JANUARY] or [MAY, DECEMBER]\",\n \"timeOfDay\": \"17:30:00\",\n \"startTimeOfDay\": \"16:00:00\",\n \"endTimeOfDay\": \"18:00:00\",\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\",\n \"timezone\": \"America/New_York\"\n },\n \"condition\": {\n \"sourceId\": \"<string>\",\n \"dataQuery\": {\n \"cid\": \"<string>\",\n \"excludeResults\": true,\n \"queryDerivedFields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"filters\": [\n {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n ],\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"distinct\": true,\n \"sorts\": [\n {\n \"field\": {\n \"field\": {\n \"name\": \"<string>\"\n }\n }\n }\n ],\n \"offset\": 123,\n \"limit\": 123,\n \"excludeNulls\": true,\n \"postProcessingRawExpressions\": [\n {\n \"name\": \"<string>\",\n \"expression\": {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n }\n ],\n \"referencedQueryCid\": \"<string>\"\n },\n \"timeFilter\": {\n \"timeField\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n },\n \"notification\": {\n \"subject\": \"<string>\",\n \"recipients\": {\n \"users\": [\n {\n \"id\": 11111,\n \"name\": \"john_doe\"\n }\n ]\n },\n \"body\": \"<string>\",\n \"redirectUrl\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"dashboards\": [\n {\n \"id\": \"00000\",\n \"name\": \"Total Sales Dashboard\"\n }\n ],\n \"description\": \"Alert description\",\n \"enabled\": true,\n \"notification \": {}\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/vnd.composer.v3+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("http://10.2.4.166:8080/composer/api/alerts/{id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/vnd.composer.v3+json")
.body("{\n \"name\": \"Alert name\",\n \"schedule\": {\n \"minutesOfHour\": 15,\n \"dayOfMonth\": 1,\n \"daysOfWeek\": [],\n \"monthsOfYear\": \"[JANUARY] or [MAY, DECEMBER]\",\n \"timeOfDay\": \"17:30:00\",\n \"startTimeOfDay\": \"16:00:00\",\n \"endTimeOfDay\": \"18:00:00\",\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\",\n \"timezone\": \"America/New_York\"\n },\n \"condition\": {\n \"sourceId\": \"<string>\",\n \"dataQuery\": {\n \"cid\": \"<string>\",\n \"excludeResults\": true,\n \"queryDerivedFields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"filters\": [\n {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n ],\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"distinct\": true,\n \"sorts\": [\n {\n \"field\": {\n \"field\": {\n \"name\": \"<string>\"\n }\n }\n }\n ],\n \"offset\": 123,\n \"limit\": 123,\n \"excludeNulls\": true,\n \"postProcessingRawExpressions\": [\n {\n \"name\": \"<string>\",\n \"expression\": {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n }\n ],\n \"referencedQueryCid\": \"<string>\"\n },\n \"timeFilter\": {\n \"timeField\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n },\n \"notification\": {\n \"subject\": \"<string>\",\n \"recipients\": {\n \"users\": [\n {\n \"id\": 11111,\n \"name\": \"john_doe\"\n }\n ]\n },\n \"body\": \"<string>\",\n \"redirectUrl\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"dashboards\": [\n {\n \"id\": \"00000\",\n \"name\": \"Total Sales Dashboard\"\n }\n ],\n \"description\": \"Alert description\",\n \"enabled\": true,\n \"notification \": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://10.2.4.166:8080/composer/api/alerts/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/vnd.composer.v3+json'
request.body = "{\n \"name\": \"Alert name\",\n \"schedule\": {\n \"minutesOfHour\": 15,\n \"dayOfMonth\": 1,\n \"daysOfWeek\": [],\n \"monthsOfYear\": \"[JANUARY] or [MAY, DECEMBER]\",\n \"timeOfDay\": \"17:30:00\",\n \"startTimeOfDay\": \"16:00:00\",\n \"endTimeOfDay\": \"18:00:00\",\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\",\n \"timezone\": \"America/New_York\"\n },\n \"condition\": {\n \"sourceId\": \"<string>\",\n \"dataQuery\": {\n \"cid\": \"<string>\",\n \"excludeResults\": true,\n \"queryDerivedFields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"filters\": [\n {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n ],\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"distinct\": true,\n \"sorts\": [\n {\n \"field\": {\n \"field\": {\n \"name\": \"<string>\"\n }\n }\n }\n ],\n \"offset\": 123,\n \"limit\": 123,\n \"excludeNulls\": true,\n \"postProcessingRawExpressions\": [\n {\n \"name\": \"<string>\",\n \"expression\": {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n }\n ],\n \"referencedQueryCid\": \"<string>\"\n },\n \"timeFilter\": {\n \"timeField\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n },\n \"notification\": {\n \"subject\": \"<string>\",\n \"recipients\": {\n \"users\": [\n {\n \"id\": 11111,\n \"name\": \"john_doe\"\n }\n ]\n },\n \"body\": \"<string>\",\n \"redirectUrl\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"dashboards\": [\n {\n \"id\": \"00000\",\n \"name\": \"Total Sales Dashboard\"\n }\n ],\n \"description\": \"Alert description\",\n \"enabled\": true,\n \"notification \": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 99999,
"name": "Alert name",
"description": "Alert description",
"enabled": true,
"referencedSource": {
"id": "00000",
"name": "Company Sales"
},
"dashboards": [
{
"id": "00000",
"name": "Total Sales Dashboard"
}
],
"creatingUserName": "<string>",
"createdDate": "2023-11-07T05:31:56Z",
"lastModifiedDate": "2023-11-07T05:31:56Z",
"schedule": {
"frequency": "ONCE",
"minutesOfHour": 15,
"dayOfMonth": 1,
"dayOfWeek": "MONDAY",
"daysOfWeek": [
"MONDAY"
],
"monthsOfYear": "[JANUARY] or [MAY, DECEMBER]",
"timeOfDay": "17:30:00",
"startTimeOfDay": "16:00:00",
"endTimeOfDay": "18:00:00",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"timezone": "America/New_York"
},
"condition": {
"sourceId": "<string>",
"dataQuery": {
"queryType": "RAW",
"cid": "<string>",
"excludeResults": true,
"queryDerivedFields": [
{
"type": "FIELD",
"expression": "<string>",
"resultType": "ATTRIBUTE"
}
],
"filters": [
{
"path": {
"name": "<string>"
},
"operation": "EQUALS",
"value": "<unknown>"
}
],
"fields": [
{
"type": "FIELD",
"expression": "<string>",
"resultType": "ATTRIBUTE"
}
],
"distinct": true,
"sorts": [
{
"field": {
"field": {
"name": "<string>"
},
"type": "FIELD"
},
"direction": "ASC"
}
],
"offset": 123,
"limit": 123,
"excludeNulls": true,
"postProcessingRawExpressions": [
{
"name": "<string>",
"expression": {
"path": {
"name": "<string>"
},
"operation": "EQUALS",
"value": "<unknown>"
}
}
],
"referencedQueryCid": "<string>",
"referenceType": "RAW_DATA_AGGREGATION"
},
"activateAlertWhenData": "EXISTS",
"timeFilter": {
"timeField": "<string>",
"from": "<string>",
"to": "<string>"
}
},
"notification": {
"notificationType": "EMAIL"
}
}{
"error": "<string>",
"details": "<string>",
"message": "<string>",
"path": "<string>",
"status": "<string>",
"code": "<string>",
"errorCode": "<string>",
"timestamp": "<string>",
"problems": [
{
"name": "<string>",
"message": "<string>",
"level": "ERROR",
"dependencies": {}
}
]
}{
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"error": "<string>",
"message": "<string>",
"path": "<string>"
}{
"error": "<string>",
"details": "<string>",
"message": "<string>",
"path": "<string>",
"status": "<string>",
"code": "<string>",
"errorCode": "<string>",
"timestamp": "<string>",
"problems": [
{
"name": "<string>",
"message": "<string>",
"level": "ERROR",
"dependencies": {}
}
]
}{
"error": "<string>",
"details": "<string>",
"message": "<string>",
"path": "<string>",
"status": "<string>",
"code": "<string>",
"errorCode": "<string>",
"timestamp": "<string>",
"problems": [
{
"name": "<string>",
"message": "<string>",
"level": "ERROR",
"dependencies": {}
}
]
}Update the existing alert (completely replace the previous version)
curl --request PUT \
--url http://10.2.4.166:8080/composer/api/alerts/{id} \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/vnd.composer.v3+json' \
--data '
{
"name": "Alert name",
"schedule": {
"minutesOfHour": 15,
"dayOfMonth": 1,
"daysOfWeek": [],
"monthsOfYear": "[JANUARY] or [MAY, DECEMBER]",
"timeOfDay": "17:30:00",
"startTimeOfDay": "16:00:00",
"endTimeOfDay": "18:00:00",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"timezone": "America/New_York"
},
"condition": {
"sourceId": "<string>",
"dataQuery": {
"cid": "<string>",
"excludeResults": true,
"queryDerivedFields": [
{
"name": "<string>",
"expression": "<string>"
}
],
"filters": [
{
"path": {
"name": "<string>"
},
"value": "<unknown>"
}
],
"fields": [
{
"name": "<string>",
"expression": "<string>"
}
],
"distinct": true,
"sorts": [
{
"field": {
"field": {
"name": "<string>"
}
}
}
],
"offset": 123,
"limit": 123,
"excludeNulls": true,
"postProcessingRawExpressions": [
{
"name": "<string>",
"expression": {
"path": {
"name": "<string>"
},
"value": "<unknown>"
}
}
],
"referencedQueryCid": "<string>"
},
"timeFilter": {
"timeField": "<string>",
"from": "<string>",
"to": "<string>"
}
},
"notification": {
"subject": "<string>",
"recipients": {
"users": [
{
"id": 11111,
"name": "john_doe"
}
]
},
"body": "<string>",
"redirectUrl": "<string>"
},
"id": "<string>",
"dashboards": [
{
"id": "00000",
"name": "Total Sales Dashboard"
}
],
"description": "Alert description",
"enabled": true,
"notification ": {}
}
'import requests
url = "http://10.2.4.166:8080/composer/api/alerts/{id}"
payload = {
"name": "Alert name",
"schedule": {
"minutesOfHour": 15,
"dayOfMonth": 1,
"daysOfWeek": [],
"monthsOfYear": "[JANUARY] or [MAY, DECEMBER]",
"timeOfDay": "17:30:00",
"startTimeOfDay": "16:00:00",
"endTimeOfDay": "18:00:00",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"timezone": "America/New_York"
},
"condition": {
"sourceId": "<string>",
"dataQuery": {
"cid": "<string>",
"excludeResults": True,
"queryDerivedFields": [
{
"name": "<string>",
"expression": "<string>"
}
],
"filters": [
{
"path": { "name": "<string>" },
"value": "<unknown>"
}
],
"fields": [
{
"name": "<string>",
"expression": "<string>"
}
],
"distinct": True,
"sorts": [{ "field": { "field": { "name": "<string>" } } }],
"offset": 123,
"limit": 123,
"excludeNulls": True,
"postProcessingRawExpressions": [
{
"name": "<string>",
"expression": {
"path": { "name": "<string>" },
"value": "<unknown>"
}
}
],
"referencedQueryCid": "<string>"
},
"timeFilter": {
"timeField": "<string>",
"from": "<string>",
"to": "<string>"
}
},
"notification": {
"subject": "<string>",
"recipients": { "users": [
{
"id": 11111,
"name": "john_doe"
}
] },
"body": "<string>",
"redirectUrl": "<string>"
},
"id": "<string>",
"dashboards": [
{
"id": "00000",
"name": "Total Sales Dashboard"
}
],
"description": "Alert description",
"enabled": True,
"notification ": {}
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/vnd.composer.v3+json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/vnd.composer.v3+json'
},
body: JSON.stringify({
name: 'Alert name',
schedule: {
minutesOfHour: 15,
dayOfMonth: 1,
daysOfWeek: [],
monthsOfYear: '[JANUARY] or [MAY, DECEMBER]',
timeOfDay: '17:30:00',
startTimeOfDay: '16:00:00',
endTimeOfDay: '18:00:00',
startDate: '2023-12-25',
endDate: '2023-12-25',
timezone: 'America/New_York'
},
condition: {
sourceId: '<string>',
dataQuery: {
cid: '<string>',
excludeResults: true,
queryDerivedFields: [{name: '<string>', expression: '<string>'}],
filters: [{path: {name: '<string>'}, value: '<unknown>'}],
fields: [{name: '<string>', expression: '<string>'}],
distinct: true,
sorts: [{field: {field: {name: '<string>'}}}],
offset: 123,
limit: 123,
excludeNulls: true,
postProcessingRawExpressions: [{name: '<string>', expression: {path: {name: '<string>'}, value: '<unknown>'}}],
referencedQueryCid: '<string>'
},
timeFilter: {timeField: '<string>', from: '<string>', to: '<string>'}
},
notification: {
subject: '<string>',
recipients: {users: [{id: 11111, name: 'john_doe'}]},
body: JSON.stringify('<string>'),
redirectUrl: '<string>'
},
id: '<string>',
dashboards: [{id: '00000', name: 'Total Sales Dashboard'}],
description: 'Alert description',
enabled: true,
'notification ': {}
})
};
fetch('http://10.2.4.166:8080/composer/api/alerts/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://10.2.4.166:8080/composer/api/alerts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Alert name',
'schedule' => [
'minutesOfHour' => 15,
'dayOfMonth' => 1,
'daysOfWeek' => [
],
'monthsOfYear' => '[JANUARY] or [MAY, DECEMBER]',
'timeOfDay' => '17:30:00',
'startTimeOfDay' => '16:00:00',
'endTimeOfDay' => '18:00:00',
'startDate' => '2023-12-25',
'endDate' => '2023-12-25',
'timezone' => 'America/New_York'
],
'condition' => [
'sourceId' => '<string>',
'dataQuery' => [
'cid' => '<string>',
'excludeResults' => true,
'queryDerivedFields' => [
[
'name' => '<string>',
'expression' => '<string>'
]
],
'filters' => [
[
'path' => [
'name' => '<string>'
],
'value' => '<unknown>'
]
],
'fields' => [
[
'name' => '<string>',
'expression' => '<string>'
]
],
'distinct' => true,
'sorts' => [
[
'field' => [
'field' => [
'name' => '<string>'
]
]
]
],
'offset' => 123,
'limit' => 123,
'excludeNulls' => true,
'postProcessingRawExpressions' => [
[
'name' => '<string>',
'expression' => [
'path' => [
'name' => '<string>'
],
'value' => '<unknown>'
]
]
],
'referencedQueryCid' => '<string>'
],
'timeFilter' => [
'timeField' => '<string>',
'from' => '<string>',
'to' => '<string>'
]
],
'notification' => [
'subject' => '<string>',
'recipients' => [
'users' => [
[
'id' => 11111,
'name' => 'john_doe'
]
]
],
'body' => '<string>',
'redirectUrl' => '<string>'
],
'id' => '<string>',
'dashboards' => [
[
'id' => '00000',
'name' => 'Total Sales Dashboard'
]
],
'description' => 'Alert description',
'enabled' => true,
'notification ' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/vnd.composer.v3+json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://10.2.4.166:8080/composer/api/alerts/{id}"
payload := strings.NewReader("{\n \"name\": \"Alert name\",\n \"schedule\": {\n \"minutesOfHour\": 15,\n \"dayOfMonth\": 1,\n \"daysOfWeek\": [],\n \"monthsOfYear\": \"[JANUARY] or [MAY, DECEMBER]\",\n \"timeOfDay\": \"17:30:00\",\n \"startTimeOfDay\": \"16:00:00\",\n \"endTimeOfDay\": \"18:00:00\",\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\",\n \"timezone\": \"America/New_York\"\n },\n \"condition\": {\n \"sourceId\": \"<string>\",\n \"dataQuery\": {\n \"cid\": \"<string>\",\n \"excludeResults\": true,\n \"queryDerivedFields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"filters\": [\n {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n ],\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"distinct\": true,\n \"sorts\": [\n {\n \"field\": {\n \"field\": {\n \"name\": \"<string>\"\n }\n }\n }\n ],\n \"offset\": 123,\n \"limit\": 123,\n \"excludeNulls\": true,\n \"postProcessingRawExpressions\": [\n {\n \"name\": \"<string>\",\n \"expression\": {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n }\n ],\n \"referencedQueryCid\": \"<string>\"\n },\n \"timeFilter\": {\n \"timeField\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n },\n \"notification\": {\n \"subject\": \"<string>\",\n \"recipients\": {\n \"users\": [\n {\n \"id\": 11111,\n \"name\": \"john_doe\"\n }\n ]\n },\n \"body\": \"<string>\",\n \"redirectUrl\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"dashboards\": [\n {\n \"id\": \"00000\",\n \"name\": \"Total Sales Dashboard\"\n }\n ],\n \"description\": \"Alert description\",\n \"enabled\": true,\n \"notification \": {}\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/vnd.composer.v3+json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("http://10.2.4.166:8080/composer/api/alerts/{id}")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/vnd.composer.v3+json")
.body("{\n \"name\": \"Alert name\",\n \"schedule\": {\n \"minutesOfHour\": 15,\n \"dayOfMonth\": 1,\n \"daysOfWeek\": [],\n \"monthsOfYear\": \"[JANUARY] or [MAY, DECEMBER]\",\n \"timeOfDay\": \"17:30:00\",\n \"startTimeOfDay\": \"16:00:00\",\n \"endTimeOfDay\": \"18:00:00\",\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\",\n \"timezone\": \"America/New_York\"\n },\n \"condition\": {\n \"sourceId\": \"<string>\",\n \"dataQuery\": {\n \"cid\": \"<string>\",\n \"excludeResults\": true,\n \"queryDerivedFields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"filters\": [\n {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n ],\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"distinct\": true,\n \"sorts\": [\n {\n \"field\": {\n \"field\": {\n \"name\": \"<string>\"\n }\n }\n }\n ],\n \"offset\": 123,\n \"limit\": 123,\n \"excludeNulls\": true,\n \"postProcessingRawExpressions\": [\n {\n \"name\": \"<string>\",\n \"expression\": {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n }\n ],\n \"referencedQueryCid\": \"<string>\"\n },\n \"timeFilter\": {\n \"timeField\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n },\n \"notification\": {\n \"subject\": \"<string>\",\n \"recipients\": {\n \"users\": [\n {\n \"id\": 11111,\n \"name\": \"john_doe\"\n }\n ]\n },\n \"body\": \"<string>\",\n \"redirectUrl\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"dashboards\": [\n {\n \"id\": \"00000\",\n \"name\": \"Total Sales Dashboard\"\n }\n ],\n \"description\": \"Alert description\",\n \"enabled\": true,\n \"notification \": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://10.2.4.166:8080/composer/api/alerts/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/vnd.composer.v3+json'
request.body = "{\n \"name\": \"Alert name\",\n \"schedule\": {\n \"minutesOfHour\": 15,\n \"dayOfMonth\": 1,\n \"daysOfWeek\": [],\n \"monthsOfYear\": \"[JANUARY] or [MAY, DECEMBER]\",\n \"timeOfDay\": \"17:30:00\",\n \"startTimeOfDay\": \"16:00:00\",\n \"endTimeOfDay\": \"18:00:00\",\n \"startDate\": \"2023-12-25\",\n \"endDate\": \"2023-12-25\",\n \"timezone\": \"America/New_York\"\n },\n \"condition\": {\n \"sourceId\": \"<string>\",\n \"dataQuery\": {\n \"cid\": \"<string>\",\n \"excludeResults\": true,\n \"queryDerivedFields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"filters\": [\n {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n ],\n \"fields\": [\n {\n \"name\": \"<string>\",\n \"expression\": \"<string>\"\n }\n ],\n \"distinct\": true,\n \"sorts\": [\n {\n \"field\": {\n \"field\": {\n \"name\": \"<string>\"\n }\n }\n }\n ],\n \"offset\": 123,\n \"limit\": 123,\n \"excludeNulls\": true,\n \"postProcessingRawExpressions\": [\n {\n \"name\": \"<string>\",\n \"expression\": {\n \"path\": {\n \"name\": \"<string>\"\n },\n \"value\": \"<unknown>\"\n }\n }\n ],\n \"referencedQueryCid\": \"<string>\"\n },\n \"timeFilter\": {\n \"timeField\": \"<string>\",\n \"from\": \"<string>\",\n \"to\": \"<string>\"\n }\n },\n \"notification\": {\n \"subject\": \"<string>\",\n \"recipients\": {\n \"users\": [\n {\n \"id\": 11111,\n \"name\": \"john_doe\"\n }\n ]\n },\n \"body\": \"<string>\",\n \"redirectUrl\": \"<string>\"\n },\n \"id\": \"<string>\",\n \"dashboards\": [\n {\n \"id\": \"00000\",\n \"name\": \"Total Sales Dashboard\"\n }\n ],\n \"description\": \"Alert description\",\n \"enabled\": true,\n \"notification \": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 99999,
"name": "Alert name",
"description": "Alert description",
"enabled": true,
"referencedSource": {
"id": "00000",
"name": "Company Sales"
},
"dashboards": [
{
"id": "00000",
"name": "Total Sales Dashboard"
}
],
"creatingUserName": "<string>",
"createdDate": "2023-11-07T05:31:56Z",
"lastModifiedDate": "2023-11-07T05:31:56Z",
"schedule": {
"frequency": "ONCE",
"minutesOfHour": 15,
"dayOfMonth": 1,
"dayOfWeek": "MONDAY",
"daysOfWeek": [
"MONDAY"
],
"monthsOfYear": "[JANUARY] or [MAY, DECEMBER]",
"timeOfDay": "17:30:00",
"startTimeOfDay": "16:00:00",
"endTimeOfDay": "18:00:00",
"startDate": "2023-12-25",
"endDate": "2023-12-25",
"timezone": "America/New_York"
},
"condition": {
"sourceId": "<string>",
"dataQuery": {
"queryType": "RAW",
"cid": "<string>",
"excludeResults": true,
"queryDerivedFields": [
{
"type": "FIELD",
"expression": "<string>",
"resultType": "ATTRIBUTE"
}
],
"filters": [
{
"path": {
"name": "<string>"
},
"operation": "EQUALS",
"value": "<unknown>"
}
],
"fields": [
{
"type": "FIELD",
"expression": "<string>",
"resultType": "ATTRIBUTE"
}
],
"distinct": true,
"sorts": [
{
"field": {
"field": {
"name": "<string>"
},
"type": "FIELD"
},
"direction": "ASC"
}
],
"offset": 123,
"limit": 123,
"excludeNulls": true,
"postProcessingRawExpressions": [
{
"name": "<string>",
"expression": {
"path": {
"name": "<string>"
},
"operation": "EQUALS",
"value": "<unknown>"
}
}
],
"referencedQueryCid": "<string>",
"referenceType": "RAW_DATA_AGGREGATION"
},
"activateAlertWhenData": "EXISTS",
"timeFilter": {
"timeField": "<string>",
"from": "<string>",
"to": "<string>"
}
},
"notification": {
"notificationType": "EMAIL"
}
}{
"error": "<string>",
"details": "<string>",
"message": "<string>",
"path": "<string>",
"status": "<string>",
"code": "<string>",
"errorCode": "<string>",
"timestamp": "<string>",
"problems": [
{
"name": "<string>",
"message": "<string>",
"level": "ERROR",
"dependencies": {}
}
]
}{
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"error": "<string>",
"message": "<string>",
"path": "<string>"
}{
"error": "<string>",
"details": "<string>",
"message": "<string>",
"path": "<string>",
"status": "<string>",
"code": "<string>",
"errorCode": "<string>",
"timestamp": "<string>",
"problems": [
{
"name": "<string>",
"message": "<string>",
"level": "ERROR",
"dependencies": {}
}
]
}{
"error": "<string>",
"details": "<string>",
"message": "<string>",
"path": "<string>",
"status": "<string>",
"code": "<string>",
"errorCode": "<string>",
"timestamp": "<string>",
"problems": [
{
"name": "<string>",
"message": "<string>",
"level": "ERROR",
"dependencies": {}
}
]
}Authorizations
HTTP Basic authentication using global administrator credentials (username and password).
Path Parameters
Alert identifier
Body
Alert update request
Alert name
255"Alert name"
Schedule of the alert's condition checks
Show child attributes
Show child attributes
Alert's condition
Show child attributes
Show child attributes
Alert's notification configuration
Show child attributes
Show child attributes
Alert id (optional)
Dashboards
Show child attributes
Show child attributes
Alert description
255"Alert description"
Whether the alert is enabled
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
Response
The alert was updated successfully
Defines the Alert object
Alert id
99999
Alert name
"Alert name"
Alert description
"Alert description"
Whether the alert is enabled
Source used for the alert condition
Show child attributes
Show child attributes
Dashboards assigned to the alert
Show child attributes
Show child attributes
User who originally created the alert
When the alert was originally created
When the alert was last modified
Schedule of the alert's condition checks
Show child attributes
Show child attributes
Alert's condition
Show child attributes
Show child attributes
Alert's notification configuration
- Option 1
- Option 2
Show child attributes
Show child attributes
Was this page helpful?