Patch the existing alert (modify selected attributes)
curl --request PATCH \
--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": "New alert name",
"id": "<string>",
"description": "New alert description",
"enabled": true
}
'import requests
url = "http://10.2.4.166:8080/composer/api/alerts/{id}"
payload = {
"name": "New alert name",
"id": "<string>",
"description": "New alert description",
"enabled": True
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/vnd.composer.v3+json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/vnd.composer.v3+json'
},
body: JSON.stringify({
name: 'New alert name',
id: '<string>',
description: 'New alert description',
enabled: true
})
};
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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'New alert name',
'id' => '<string>',
'description' => 'New alert description',
'enabled' => true
]),
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\": \"New alert name\",\n \"id\": \"<string>\",\n \"description\": \"New alert description\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("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\": \"New alert name\",\n \"id\": \"<string>\",\n \"description\": \"New alert description\",\n \"enabled\": true\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::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/vnd.composer.v3+json'
request.body = "{\n \"name\": \"New alert name\",\n \"id\": \"<string>\",\n \"description\": \"New alert description\",\n \"enabled\": true\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": {}
}
]
}Patch the existing alert (modify selected attributes)
Patch the existing alert (modify selected attributes)
curl --request PATCH \
--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": "New alert name",
"id": "<string>",
"description": "New alert description",
"enabled": true
}
'import requests
url = "http://10.2.4.166:8080/composer/api/alerts/{id}"
payload = {
"name": "New alert name",
"id": "<string>",
"description": "New alert description",
"enabled": True
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/vnd.composer.v3+json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/vnd.composer.v3+json'
},
body: JSON.stringify({
name: 'New alert name',
id: '<string>',
description: 'New alert description',
enabled: true
})
};
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 => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'New alert name',
'id' => '<string>',
'description' => 'New alert description',
'enabled' => true
]),
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\": \"New alert name\",\n \"id\": \"<string>\",\n \"description\": \"New alert description\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("PATCH", 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.patch("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\": \"New alert name\",\n \"id\": \"<string>\",\n \"description\": \"New alert description\",\n \"enabled\": true\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::Patch.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/vnd.composer.v3+json'
request.body = "{\n \"name\": \"New alert name\",\n \"id\": \"<string>\",\n \"description\": \"New alert description\",\n \"enabled\": true\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
Body
application/vnd.composer.v3+json
Response
The alert was updated successfully
Defines the Alert object
Was this page helpful?