Update monitor alert
curl --request PUT \
--url https://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rule": {
"kind": "count",
"threshold": 2
}
}
'import requests
url = "https://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id}"
payload = { "rule": {
"kind": "count",
"threshold": 2
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({rule: {kind: 'count', threshold: 2}})
};
fetch('https://api.uselemma.ai/monitors/{monitor_id}/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://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_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([
'rule' => [
'kind' => 'count',
'threshold' => 2
]
]),
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.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id}"
payload := strings.NewReader("{\n \"rule\": {\n \"kind\": \"count\",\n \"threshold\": 2\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rule\": {\n \"kind\": \"count\",\n \"threshold\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rule\": {\n \"kind\": \"count\",\n \"threshold\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"monitor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule": {
"kind": "count",
"threshold": 2,
"window": "1h",
"cooldown": "1h"
},
"firing": {
"status": "armed",
"suppressed_count": 1,
"cooldown_until": "2023-11-07T05:31:56Z"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>",
"code": "<string>",
"retryable": true,
"retry_after_seconds": 1
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>",
"retryable": true,
"retry_after_seconds": 1
}{
"detail": "<string>",
"code": "internal_error",
"retryable": false,
"request_id": "<string>"
}Monitors
Update monitor alert
Replaces the alert’s rule and re-arms it. Alerts are enabled per organization; without it every alert call returns 404. A monitor can have at most 10 alerts: another returns 409 monitor_alert_limit_reached. Alerts post to the project’s Slack channel.
PUT
/
monitors
/
{monitor_id}
/
alerts
/
{alert_id}
Update monitor alert
curl --request PUT \
--url https://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rule": {
"kind": "count",
"threshold": 2
}
}
'import requests
url = "https://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id}"
payload = { "rule": {
"kind": "count",
"threshold": 2
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({rule: {kind: 'count', threshold: 2}})
};
fetch('https://api.uselemma.ai/monitors/{monitor_id}/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://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_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([
'rule' => [
'kind' => 'count',
'threshold' => 2
]
]),
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.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id}"
payload := strings.NewReader("{\n \"rule\": {\n \"kind\": \"count\",\n \"threshold\": 2\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rule\": {\n \"kind\": \"count\",\n \"threshold\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselemma.ai/monitors/{monitor_id}/alerts/{alert_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"rule\": {\n \"kind\": \"count\",\n \"threshold\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"monitor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"rule": {
"kind": "count",
"threshold": 2,
"window": "1h",
"cooldown": "1h"
},
"firing": {
"status": "armed",
"suppressed_count": 1,
"cooldown_until": "2023-11-07T05:31:56Z"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": "<string>",
"code": "<string>",
"retryable": true,
"retry_after_seconds": 1
}{
"detail": "<string>",
"code": "<string>"
}{
"detail": "<string>",
"code": "<string>",
"retryable": true,
"retry_after_seconds": 1
}{
"detail": "<string>",
"code": "internal_error",
"retryable": false,
"request_id": "<string>"
}Authorizations
Body
application/json