Edit an alert rule
curl --request PATCH \
--url https://app.traceroot.ai/api/v1/public/alerts/{alert_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"key": "<string>"
}
],
"measure": "<string>",
"name": "<string>",
"threshold": 123,
"view": "SPANS"
}
'import requests
url = "https://app.traceroot.ai/api/v1/public/alerts/{alert_id}"
payload = {
"project_id": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"key": "<string>"
}
],
"measure": "<string>",
"name": "<string>",
"threshold": 123,
"view": "SPANS"
}
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({
project_id: '<string>',
filters: [{field: '<string>', value: '<string>', key: '<string>'}],
measure: '<string>',
name: '<string>',
threshold: 123,
view: 'SPANS'
})
};
fetch('https://app.traceroot.ai/api/v1/public/alerts/{alert_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_URL => "https://app.traceroot.ai/api/v1/public/alerts/{alert_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([
'project_id' => '<string>',
'filters' => [
[
'field' => '<string>',
'value' => '<string>',
'key' => '<string>'
]
],
'measure' => '<string>',
'name' => '<string>',
'threshold' => 123,
'view' => 'SPANS'
]),
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://app.traceroot.ai/api/v1/public/alerts/{alert_id}"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ],\n \"measure\": \"<string>\",\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"view\": \"SPANS\"\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://app.traceroot.ai/api/v1/public/alerts/{alert_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ],\n \"measure\": \"<string>\",\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"view\": \"SPANS\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.traceroot.ai/api/v1/public/alerts/{alert_id}")
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 \"project_id\": \"<string>\",\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ],\n \"measure\": \"<string>\",\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"view\": \"SPANS\"\n}"
response = http.request(request)
puts response.read_body{
"alert": {
"aggregation": "<string>",
"alerted_at": "2023-11-07T05:31:56Z",
"create_time": "2023-11-07T05:31:56Z",
"creator": "<string>",
"filters": [
{
"field": "<string>",
"op": "=",
"value": "<string>",
"key": "<string>"
}
],
"id": "<string>",
"last_error": "<string>",
"last_error_at": "2023-11-07T05:31:56Z",
"last_evaluated_at": "2023-11-07T05:31:56Z",
"last_notify_at": "2023-11-07T05:31:56Z",
"last_notify_error": "<string>",
"last_notify_status": "<string>",
"measure": "<string>",
"name": "<string>",
"no_data_mode": "<string>",
"renotify": {
"mode": "OFF",
"interval_minutes": 123
},
"severity": "<string>",
"severity_changed_at": "2023-11-07T05:31:56Z",
"status": "<string>",
"threshold": 123,
"threshold_operator": "<string>",
"update_time": "2023-11-07T05:31:56Z",
"view": "<string>",
"window": "<string>"
},
"changed": [
"<string>"
],
"updated": true,
"page_cleared": false,
"state_reset": false
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"detail": "<string>"
}Alerts
Edit an alert rule
Update a threshold alert in a traceroot project. Changes to evaluated fields reset its state, while changing only the alert name preserves it.
PATCH
/
api
/
v1
/
public
/
alerts
/
{alert_id}
Edit an alert rule
curl --request PATCH \
--url https://app.traceroot.ai/api/v1/public/alerts/{alert_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"project_id": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"key": "<string>"
}
],
"measure": "<string>",
"name": "<string>",
"threshold": 123,
"view": "SPANS"
}
'import requests
url = "https://app.traceroot.ai/api/v1/public/alerts/{alert_id}"
payload = {
"project_id": "<string>",
"filters": [
{
"field": "<string>",
"value": "<string>",
"key": "<string>"
}
],
"measure": "<string>",
"name": "<string>",
"threshold": 123,
"view": "SPANS"
}
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({
project_id: '<string>',
filters: [{field: '<string>', value: '<string>', key: '<string>'}],
measure: '<string>',
name: '<string>',
threshold: 123,
view: 'SPANS'
})
};
fetch('https://app.traceroot.ai/api/v1/public/alerts/{alert_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_URL => "https://app.traceroot.ai/api/v1/public/alerts/{alert_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([
'project_id' => '<string>',
'filters' => [
[
'field' => '<string>',
'value' => '<string>',
'key' => '<string>'
]
],
'measure' => '<string>',
'name' => '<string>',
'threshold' => 123,
'view' => 'SPANS'
]),
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://app.traceroot.ai/api/v1/public/alerts/{alert_id}"
payload := strings.NewReader("{\n \"project_id\": \"<string>\",\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ],\n \"measure\": \"<string>\",\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"view\": \"SPANS\"\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://app.traceroot.ai/api/v1/public/alerts/{alert_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_id\": \"<string>\",\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ],\n \"measure\": \"<string>\",\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"view\": \"SPANS\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.traceroot.ai/api/v1/public/alerts/{alert_id}")
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 \"project_id\": \"<string>\",\n \"filters\": [\n {\n \"field\": \"<string>\",\n \"value\": \"<string>\",\n \"key\": \"<string>\"\n }\n ],\n \"measure\": \"<string>\",\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"view\": \"SPANS\"\n}"
response = http.request(request)
puts response.read_body{
"alert": {
"aggregation": "<string>",
"alerted_at": "2023-11-07T05:31:56Z",
"create_time": "2023-11-07T05:31:56Z",
"creator": "<string>",
"filters": [
{
"field": "<string>",
"op": "=",
"value": "<string>",
"key": "<string>"
}
],
"id": "<string>",
"last_error": "<string>",
"last_error_at": "2023-11-07T05:31:56Z",
"last_evaluated_at": "2023-11-07T05:31:56Z",
"last_notify_at": "2023-11-07T05:31:56Z",
"last_notify_error": "<string>",
"last_notify_status": "<string>",
"measure": "<string>",
"name": "<string>",
"no_data_mode": "<string>",
"renotify": {
"mode": "OFF",
"interval_minutes": 123
},
"severity": "<string>",
"severity_changed_at": "2023-11-07T05:31:56Z",
"status": "<string>",
"threshold": 123,
"threshold_operator": "<string>",
"update_time": "2023-11-07T05:31:56Z",
"view": "<string>",
"window": "<string>"
},
"changed": [
"<string>"
],
"updated": true,
"page_cleared": false,
"state_reset": false
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}{
"detail": "<string>"
}Use a user credential with the
MEMBER role or higher in the workspace.
Changing an evaluated field resets evaluation, clears an open page, and re-arms a parked alert. Renaming the alert alone leaves its evaluation state unchanged.Authorizations
Body
application/json
Body for editing an alert rule (the ten rule fields, all optional).
The write service validates the patch merged with the stored rule; an edit to any evaluated field resets the evaluation state (and clears an open page), which the response reports. Status has its own route.
Response
Successful Response
The updated alert with its full rule, plus what the edit did to its state.