Create Alert Rule
curl --request POST \
--url https://api.revring.ai/v1/alert-rules \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"threshold": 123,
"agentId": "<string>",
"comparator": "above",
"windowMinutes": 60,
"minCalls": 10,
"webhookUrl": "<string>",
"slackWebhookUrl": "<string>",
"enabled": true
}
'import requests
url = "https://api.revring.ai/v1/alert-rules"
payload = {
"name": "<string>",
"threshold": 123,
"agentId": "<string>",
"comparator": "above",
"windowMinutes": 60,
"minCalls": 10,
"webhookUrl": "<string>",
"slackWebhookUrl": "<string>",
"enabled": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
threshold: 123,
agentId: '<string>',
comparator: 'above',
windowMinutes: 60,
minCalls: 10,
webhookUrl: '<string>',
slackWebhookUrl: '<string>',
enabled: true
})
};
fetch('https://api.revring.ai/v1/alert-rules', 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.revring.ai/v1/alert-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'threshold' => 123,
'agentId' => '<string>',
'comparator' => 'above',
'windowMinutes' => 60,
'minCalls' => 10,
'webhookUrl' => '<string>',
'slackWebhookUrl' => '<string>',
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.revring.ai/v1/alert-rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"agentId\": \"<string>\",\n \"comparator\": \"above\",\n \"windowMinutes\": 60,\n \"minCalls\": 10,\n \"webhookUrl\": \"<string>\",\n \"slackWebhookUrl\": \"<string>\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.post("https://api.revring.ai/v1/alert-rules")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"agentId\": \"<string>\",\n \"comparator\": \"above\",\n \"windowMinutes\": 60,\n \"minCalls\": 10,\n \"webhookUrl\": \"<string>\",\n \"slackWebhookUrl\": \"<string>\",\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.revring.ai/v1/alert-rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"agentId\": \"<string>\",\n \"comparator\": \"above\",\n \"windowMinutes\": 60,\n \"minCalls\": 10,\n \"webhookUrl\": \"<string>\",\n \"slackWebhookUrl\": \"<string>\",\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"name": "<string>",
"agentId": "<string>",
"metric": "call_failure_rate",
"comparator": "above",
"threshold": 123,
"windowMinutes": 60,
"minCalls": 10,
"webhookUrl": "<string>",
"slackWebhookUrl": "<string>",
"enabled": true,
"id": "<string>",
"state": "ok",
"lastValue": 123,
"lastSample": 123,
"lastEvaluatedAt": "2023-11-07T05:31:56Z",
"lastTriggeredAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>"
}{
"error": "unauthorized"
}Alerts
Create Alert Rule
POST
/
alert-rules
Create Alert Rule
curl --request POST \
--url https://api.revring.ai/v1/alert-rules \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "<string>",
"threshold": 123,
"agentId": "<string>",
"comparator": "above",
"windowMinutes": 60,
"minCalls": 10,
"webhookUrl": "<string>",
"slackWebhookUrl": "<string>",
"enabled": true
}
'import requests
url = "https://api.revring.ai/v1/alert-rules"
payload = {
"name": "<string>",
"threshold": 123,
"agentId": "<string>",
"comparator": "above",
"windowMinutes": 60,
"minCalls": 10,
"webhookUrl": "<string>",
"slackWebhookUrl": "<string>",
"enabled": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
threshold: 123,
agentId: '<string>',
comparator: 'above',
windowMinutes: 60,
minCalls: 10,
webhookUrl: '<string>',
slackWebhookUrl: '<string>',
enabled: true
})
};
fetch('https://api.revring.ai/v1/alert-rules', 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.revring.ai/v1/alert-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'threshold' => 123,
'agentId' => '<string>',
'comparator' => 'above',
'windowMinutes' => 60,
'minCalls' => 10,
'webhookUrl' => '<string>',
'slackWebhookUrl' => '<string>',
'enabled' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.revring.ai/v1/alert-rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"agentId\": \"<string>\",\n \"comparator\": \"above\",\n \"windowMinutes\": 60,\n \"minCalls\": 10,\n \"webhookUrl\": \"<string>\",\n \"slackWebhookUrl\": \"<string>\",\n \"enabled\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.post("https://api.revring.ai/v1/alert-rules")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"agentId\": \"<string>\",\n \"comparator\": \"above\",\n \"windowMinutes\": 60,\n \"minCalls\": 10,\n \"webhookUrl\": \"<string>\",\n \"slackWebhookUrl\": \"<string>\",\n \"enabled\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.revring.ai/v1/alert-rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"threshold\": 123,\n \"agentId\": \"<string>\",\n \"comparator\": \"above\",\n \"windowMinutes\": 60,\n \"minCalls\": 10,\n \"webhookUrl\": \"<string>\",\n \"slackWebhookUrl\": \"<string>\",\n \"enabled\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"name": "<string>",
"agentId": "<string>",
"metric": "call_failure_rate",
"comparator": "above",
"threshold": 123,
"windowMinutes": 60,
"minCalls": 10,
"webhookUrl": "<string>",
"slackWebhookUrl": "<string>",
"enabled": true,
"id": "<string>",
"state": "ok",
"lastValue": 123,
"lastSample": 123,
"lastEvaluatedAt": "2023-11-07T05:31:56Z",
"lastTriggeredAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>"
}{
"error": "unauthorized"
}Authorizations
API key for authentication. Generate API keys from the RevRing dashboard.
Body
application/json
Create an alert rule. Needs webhookUrl, slackWebhookUrl or both.
Maximum string length:
100Percent (0-100) for rates; a number of calls for call_count
Only this agent's calls; null for all agents
Available options:
above, below Available options:
15, 60, 240, 1440 Rates are only judged with at least this many calls in the window
Required range:
x >= 1https endpoint for JSON notifications (signed when you have a signing secret)
Slack incoming webhook URL (https://hooks.slack.com/...)
Response
Created
Show child attributes
Show child attributes