curl --request PATCH \
--url https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metricGroupId": "metricGroup_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": [
"team@example.com"
]
}
'import requests
url = "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload = {
"metricGroupId": "metricGroup_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": ["team@example.com"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metricGroupId: 'metricGroup_123',
window: 'ONE_HOUR',
badSessionScore: 0.5,
threshold: 3,
recipients: ['team@example.com']
})
};
fetch('https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}",
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([
'metricGroupId' => 'metricGroup_123',
'window' => 'ONE_HOUR',
'badSessionScore' => 0.5,
'threshold' => 3,
'recipients' => [
'team@example.com'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/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 := "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload := strings.NewReader("{\n \"metricGroupId\": \"metricGroup_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metricGroupId\": \"metricGroup_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metricGroupId\": \"metricGroup_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "monitorAlertRule_123",
"monitorId": "monitor_123",
"type": "BAD_SESSION_COUNT",
"metricGroupId": "metricGroup_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": [
"team@example.com"
],
"userId": "user_123",
"createdAt": "2023-11-07T05:31:56Z",
"pausedAt": null
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}Update a monitor alert rule
Patches one or more fields of an alert rule. The merged rule (patch over the stored row) is what gets validated. The type cannot change: delete the rule and create a new one.
curl --request PATCH \
--url https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metricGroupId": "metricGroup_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": [
"team@example.com"
]
}
'import requests
url = "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload = {
"metricGroupId": "metricGroup_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": ["team@example.com"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metricGroupId: 'metricGroup_123',
window: 'ONE_HOUR',
badSessionScore: 0.5,
threshold: 3,
recipients: ['team@example.com']
})
};
fetch('https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}",
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([
'metricGroupId' => 'metricGroup_123',
'window' => 'ONE_HOUR',
'badSessionScore' => 0.5,
'threshold' => 3,
'recipients' => [
'team@example.com'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/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 := "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload := strings.NewReader("{\n \"metricGroupId\": \"metricGroup_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metricGroupId\": \"metricGroup_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metricGroupId\": \"metricGroup_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "monitorAlertRule_123",
"monitorId": "monitor_123",
"type": "BAD_SESSION_COUNT",
"metricGroupId": "metricGroup_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": [
"team@example.com"
],
"userId": "user_123",
"createdAt": "2023-11-07T05:31:56Z",
"pausedAt": null
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}Authorizations
API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....
Path Parameters
Monitor ID
"monitor_123"
Alert rule ID
"monitorAlertRule_123"
Body
A metric family this monitor scores
1"metricGroup_123"
The trailing window the rule evaluates
FIFTEEN_MINUTES, ONE_HOUR, SIX_HOURS, TWENTY_FOUR_HOURS "ONE_HOUR"
BAD_SESSION_COUNT only: a session counts as bad at or below this score.
0.5
The count, percentage, or score the rule fires on, by type
3
Free-text email addresses notified when the rule fires (1 to 20)
1 - 20 elements["team@example.com"]
Response
Alert rule updated successfully
"monitorAlertRule_123"
"monitor_123"
BAD_SESSION_COUNT, NO_SCORE_RATE, AVERAGE_SCORE "BAD_SESSION_COUNT"
"metricGroup_123"
FIFTEEN_MINUTES, ONE_HOUR, SIX_HOURS, TWENTY_FOUR_HOURS "ONE_HOUR"
0.5
3
["team@example.com"]
"user_123"
When the rule was paused; null while it is active
null