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",
"specificationId": "specification_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": [
"team@example.com"
],
"webhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX"
}
'import requests
url = "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload = {
"metricGroupId": "metricGroup_123",
"specificationId": "specification_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": ["team@example.com"],
"webhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX"
}
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',
specificationId: 'specification_123',
window: 'ONE_HOUR',
badSessionScore: 0.5,
threshold: 3,
recipients: ['team@example.com'],
webhookUrl: 'https://hooks.slack.com/services/T000/B000/XXXX'
})
};
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',
'specificationId' => 'specification_123',
'window' => 'ONE_HOUR',
'badSessionScore' => 0.5,
'threshold' => 3,
'recipients' => [
'team@example.com'
],
'webhookUrl' => 'https://hooks.slack.com/services/T000/B000/XXXX'
]),
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 \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\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 \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\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 \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\n}"
response = http.request(request)
puts response.read_body{
"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 and the kind of target (metric family or Specification) cannot change: delete the rule and create a new one. A webhook URL set for the first time gets its signing secret generated; read it with regenerate-alert-rule-webhook-secret.
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",
"specificationId": "specification_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": [
"team@example.com"
],
"webhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX"
}
'import requests
url = "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload = {
"metricGroupId": "metricGroup_123",
"specificationId": "specification_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": ["team@example.com"],
"webhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX"
}
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',
specificationId: 'specification_123',
window: 'ONE_HOUR',
badSessionScore: 0.5,
threshold: 3,
recipients: ['team@example.com'],
webhookUrl: 'https://hooks.slack.com/services/T000/B000/XXXX'
})
};
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',
'specificationId' => 'specification_123',
'window' => 'ONE_HOUR',
'badSessionScore' => 0.5,
'threshold' => 3,
'recipients' => [
'team@example.com'
],
'webhookUrl' => 'https://hooks.slack.com/services/T000/B000/XXXX'
]),
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 \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\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 \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\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 \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\n}"
response = http.request(request)
puts response.read_body{
"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
Path Parameters
Body
URL that receives a signed POST when an alert opens or recovers. It must use https, unless the deployment allows http. A Slack incoming-webhook URL posts a message to its channel. Write-only: responses show only its host and port. On update, null removes it and leaving it out keeps it. Read the signing secret with regenerate-alert-rule-webhook-secret.
1 - 2048"https://hooks.slack.com/services/T000/B000/XXXX"
Response
Alert rule updated successfully