PUT Edit an individual rule with expected_version. Monitor, series and rule type stay fixed; managed rules use their configuration editor. A new evidence revision preserves incident history.
/api/v1/alarms/rules/{id}
Edit an individual rule with expected_version. Monitor, series and rule type stay fixed; managed rules use their configuration editor. A new evidence revision preserves incident history.
On this page
Access and permissions
Edit an individual rule with expected_version. Monitor, series and rule type stay fixed; managed rules use their configuration editor. A new evidence revision preserves incident history.
Browser session: __Host-mb_session cookie.
Machine management credentials in Authorization: Bearer. Check the permissions (scopes) required by the operation.
When using a browser session for a mutation, send the current CSRF token in X-CSRF-Token with the same-site cookie. OAuth consent uses its documented form field.
Parameters and headers
| Field | Location | Type and limits | Required | Meaning |
|---|---|---|---|---|
| id | Path | string; {"format":"uuid"} | Yes | Resource UUID from the path. It must exist and be accessible to the acting identity. |
| Origin | Header | string; {"format":"uri"} | No | If present, must match the canonical HTTPS origin. Sec-Fetch-Site cross-site is rejected. |
| X-CSRF-Token | Header | string | No | Browser CSRF cookie value. Not required when an allowed machine management credential is used. |
Request body
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | AlarmRuleUpdate | Yes | — |
| $.clear | AlarmCondition | No | — |
| $.clear.operator | string; {"enum":["gt","lt","eq","ne","outside","inside"]} | Yes | — |
| $.clear.value | number | Yes | — |
| $.clear.value_high | number | No | Required for inside and outside; must be greater than value |
| $.clear (allOf 1) | JSON | No | — |
| $.clear_duration_seconds | integer; {"default":0,"maximum":86400,"minimum":0} | No | — |
| $.device_id | string; {"format":"uuid"} | Yes | UUID of the target device or monitor. The ingestion key must allow this device. |
| $.equality_tolerance | number; {"default":0,"minimum":0} | No | — |
| $.escalation_policy_id | string; {"format":"uuid"} | null | No | — |
| $.escalation_policy_id (anyOf 1) | string; {"format":"uuid"} | No | — |
| $.escalation_policy_id (anyOf 2) | null | No | — |
| $.event_case_sensitive | boolean; {"default":false} | No | — |
| $.event_contains | string; {"maxLength":128} | No | Text only; literal text comparison. Empty only with contains. |
| $.event_min_severity | string; {"enum":["info","warning","critical"]} | No | Text only; default info |
| $.event_operator | string; {"default":"contains","enum":["contains","not_contains","eq","ne"]} | No | — |
| $.event_whole_word | boolean; {"default":false} | No | Only for contains and not_contains |
| $.expected_config_revision | integer; {"minimum":1} | No | — |
| $.expected_version | integer; {"minimum":1} | Yes | — |
| $.kind | string; {"enum":["numeric","state","text","no_data","heartbeat","run"]} | Yes | run applies only to job, workflow and AI monitors when run events are enabled; one incident per monitor rule. |
| $.name | string; {"maxLength":128} | Yes | Human-readable resource name. Follow the listed length limit. |
| $.no_data_seconds | integer; {"maximum":604800,"minimum":30} | No | — |
| $.notification_destination_ids | array<string; {"format":"uuid"}>; {"maxItems":20} | No | — |
| $.notification_destination_ids[] | string; {"format":"uuid"} | Yes | — |
| $.notification_mode | string; {"enum":["all_active","selected"]} | No | — |
| $.quiet_seconds | integer; {"default":300,"maximum":86400,"minimum":30} | No | Text only; grouped incident clears after the quiet period |
| $.reminder_limit | integer; {"maximum":4,"minimum":0} | No | — |
| $.reminders_enabled | boolean | No | — |
| $.repeat_seconds | integer; {"default":1800,"maximum":86400,"minimum":1800} | No | Minimum interval before repeating an unresolved alarm notification. |
| $.routing_source | string; {"enum":["monitor","individual"]} | No | — |
| $.series_id | string; {"format":"uuid"} | No | Required for numeric, state and no_data rules. |
| $.severity | string; {"enum":["info","warning","critical"]} | Yes | Severity value from the listed vocabulary. |
| $.state_clear_samples | integer; {"default":1,"maximum":2,"minimum":0} | No | One or two consecutive fresh observations for a state rule. Omitted or zero uses one; non-state rules must use one. |
| $.state_trigger_samples | integer; {"default":1,"maximum":2,"minimum":0} | No | One or two consecutive fresh observations for a state rule. Omitted or zero uses one; non-state rules must use one. |
| $.suggestion_key | string; {"maxLength":272} | No | — |
| $.target_state | string; {"maxLength":128,"minLength":1} | No | Required for state; exact Boolean true or false, or enum value. A new matching measurement triggers the alarm; the next different value clears it. |
| $.trigger | AlarmCondition | No | — |
| $.trigger.operator | string; {"enum":["gt","lt","eq","ne","outside","inside"]} | Yes | — |
| $.trigger.value | number | Yes | — |
| $.trigger.value_high | number | No | Required for inside and outside; must be greater than value |
| $.trigger (allOf 1) | JSON | No | — |
| $.trigger_duration_seconds | integer; {"default":0,"maximum":86400,"minimum":0} | No | — |
| $.window_function | string; {"default":"last","enum":["last","avg","min","max"]} | No | Numeric only; the same function is used for triggering and clearing. UTC-second buckets; average is weighted by measurement count. |
| $.window_seconds | integer; {"default":0,"maximum":900,"minimum":0} | No | For avg/min/max, at least 10 seconds and two expected measurement intervals; the window restarts after a data gap. |
| $ (allOf 1) | JSON | No | — |
| $ (allOf 2) | JSON | No | — |
| $ (allOf 3) | JSON | No | — |
| $ (allOf 4) | JSON | No | — |
| $ (allOf 5) | JSON | No | — |
Responses
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | object | Yes | — |
| Stable error codes |
|---|
| invalid_confirmations |
| invalid_idempotency_key |
| invalid_repeat |
| invalid_rule |
| invalid_run_monitor |
| invalid_selection |
| invalid_window |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 422,
"title": "Demo error",
"type": "about:blank"
}| Stable error codes |
|---|
| feature_unavailable |
| unavailable |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Retry-After | string; {"pattern":"^[0-9]+$"} | Seconds before retry. Preserve supported idempotency identifiers and respect the operation’s mutation semantics. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 503,
"title": "Demo error",
"type": "about:blank"
}| Stable error codes |
|---|
| idempotency_conflict |
| managed_rule |
| revision_conflict |
| suggestion_exists |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 409,
"title": "Demo error",
"type": "about:blank"
}| Stable error codes |
|---|
| csrf |
| forbidden |
| insufficient_scope |
| invalid_origin |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 403,
"title": "Demo error",
"type": "about:blank"
}| Stable error codes |
|---|
| creation_quota |
| rule_limit |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Retry-After | string; {"pattern":"^[0-9]+$"} | Seconds before retry. Preserve supported idempotency identifiers and respect the operation’s mutation semantics. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 429,
"title": "Demo error",
"type": "about:blank"
}| Stable error codes |
|---|
| not_found |
| unavailable |
| Header | Type and limits | Meaning |
|---|---|---|
| Cache-Control | string; {"pattern":"(?:^|,\\s*)no-store(?:,|$)"} | Private API responses prohibit storage. Public OAuth metadata is cached for 300 seconds; live streams additionally prohibit transformation. |
| Content-Language | string; {"enum":["en","de"]} | Language of human-readable response text, resolved from Accept-Language or the documented browser preference. Technical codes and identifiers remain stable. |
| Referrer-Policy | JSON; {"enum":["strict-origin-when-cross-origin","no-referrer"]} | The default referrer policy is strict-origin-when-cross-origin. Provider-login responses use no-referrer to protect login parameters. |
| Retry-After | string; {"pattern":"^[0-9]+$"} | Seconds before retry. Preserve supported idempotency identifiers and respect the operation’s mutation semantics. |
| Vary | string | Responses vary by Accept-Language; browser-rendered responses can also vary by the preference cookie. |
| X-Content-Type-Options | JSON; {"const":"nosniff"} | The browser must use the declared content type. |
| X-Frame-Options | JSON; {"const":"DENY"} | The response must not be embedded in a frame. |
| X-Request-ID | string | Server-generated request identifier. Include this when reporting an error; inbound values are not trusted. |
application/problem+json
| Field | Type and limits | Required | Meaning |
|---|---|---|---|
| $ | Problem | Yes | — |
| $.code | string | Yes | Stable machine-readable error code |
| $.detail | string | Yes | Short localized explanation without internal error details |
| $.instance | string | Yes | Unique relative identifier /api/v1/requests/{request_id}; not a retrievable resource |
| $.message | string | Yes | Temporarily identical to detail for existing clients |
| $.message_key | string | Yes | Stable translation key for changing the displayed language without another request |
| $.message_params | object; {"additionalProperties":true} | Yes | Named, safely rendered message parameters; never arbitrary HTML |
| $.request_id | string; {"pattern":"^[0-9a-f]{32}$"} | Yes | Server-generated diagnostic identifier. It contains no login token or credential. |
| $.status | integer; {"maximum":599,"minimum":400} | Yes | — |
| $.title | string | Yes | Localized HTTP status title |
| $.type | string; {"const":"about:blank"} | Yes | — |
{
"code": "demo",
"detail": "Demo error detail; inspect the documented code.",
"instance": "demo",
"message": "Demo error detail; inspect the documented code.",
"message_key": "errors.requestFailed",
"message_params": {},
"request_id": "00000000000000000000000000000000",
"status": 503,
"title": "Demo error",
"type": "about:blank"
}Retries and asynchronous work
This change does not have a general retry guarantee. If the response is unclear, read the affected resource before trying again. Follow Retry-After waiting times and request new sign-in or action codes when they expire.
Request examples
Replace demo IDs, timestamps and placeholders with your own values. For a retry, keep the same IDs, time and content. These examples do not run requests on this page.
Keep login links, codes, cookies and keys private. Do not print them in logs or share them in support requests.
curl --silent --show-error --output /dev/null --write-out "%{http_code}\n" \
--request PUT \
--header @"$HOME/.config/metribeacon/headers.txt" \
--header "Content-Type: application/json" \
--data-binary '{"expected_version":1,"device_id":"00000000-0000-4000-8000-000000000001","series_id":"00000000-0000-4000-8000-000000000001","name":"Demo high value","kind":"numeric","severity":"warning","trigger":{"operator":"gt","value":80},"clear":{"operator":"lt","value":75},"repeat_seconds":1800}' \
"https://metribeacon.com/api/v1/alarms/rules/00000000-0000-4000-8000-000000000001"
import json
from pathlib import Path
from urllib.request import Request, HTTPRedirectHandler, build_opener
from urllib.error import HTTPError
headers = json.loads((Path.home() / ".config/metribeacon/headers.json").read_text())
headers["Content-Type"] = "application/json"
request = Request('https://metribeacon.com/api/v1/alarms/rules/00000000-0000-4000-8000-000000000001', data='{"expected_version":1,"device_id":"00000000-0000-4000-8000-000000000001","series_id":"00000000-0000-4000-8000-000000000001","name":"Demo high value","kind":"numeric","severity":"warning","trigger":{"operator":"gt","value":80},"clear":{"operator":"lt","value":75},"repeat_seconds":1800}'.encode("utf-8"), headers=headers, method='PUT')
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, request, fp, code, message, headers, target):
return None
opener = build_opener(NoRedirect())
try:
with opener.open(request, timeout=10) as response:
print(response.status)
except HTTPError as error:
print(error.code)
error.close()
import { readFile } from "node:fs/promises";
import { homedir } from "node:os";
import { join } from "node:path";
const headers = JSON.parse(await readFile(join(homedir(), ".config/metribeacon/headers.json"), "utf8"));
const response = await fetch("https://metribeacon.com/api/v1/alarms/rules/00000000-0000-4000-8000-000000000001", {
method: "PUT", headers: {...headers, "Content-Type":"application/json"}, body:"{\"expected_version\":1,\"device_id\":\"00000000-0000-4000-8000-000000000001\",\"series_id\":\"00000000-0000-4000-8000-000000000001\",\"name\":\"Demo high value\",\"kind\":\"numeric\",\"severity\":\"warning\",\"trigger\":{\"operator\":\"gt\",\"value\":80},\"clear\":{\"operator\":\"lt\",\"value\":75},\"repeat_seconds\":1800}", redirect: "manual",
signal: AbortSignal.timeout(10000),
});
console.log(response.status);
await response.body?.cancel();
package main
import (
"fmt"
"net/http"
"strings"
"time"
"encoding/json"
"os"
"path/filepath"
)
func main() {
home, err := os.UserHomeDir(); if err != nil { panic("credentials unavailable") }
raw, err := os.ReadFile(filepath.Join(home, ".config/metribeacon/headers.json")); if err != nil { panic("credentials unavailable") }
var headers map[string]string
if json.Unmarshal(raw, &headers) != nil { panic("invalid local headers") }
request, err := http.NewRequest("PUT", "https://metribeacon.com/api/v1/alarms/rules/00000000-0000-4000-8000-000000000001", strings.NewReader("{\"expected_version\":1,\"device_id\":\"00000000-0000-4000-8000-000000000001\",\"series_id\":\"00000000-0000-4000-8000-000000000001\",\"name\":\"Demo high value\",\"kind\":\"numeric\",\"severity\":\"warning\",\"trigger\":{\"operator\":\"gt\",\"value\":80},\"clear\":{\"operator\":\"lt\",\"value\":75},\"repeat_seconds\":1800}")); if err != nil { panic("request invalid") }
request.Header.Set("Content-Type", "application/json")
for name, value := range headers { request.Header.Set(name, value) }
client := &http.Client{Timeout: 10*time.Second, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
response, err := client.Do(request); if err != nil { panic("request failed") }
defer response.Body.Close()
fmt.Println(response.StatusCode)
}
Related guides
- HTTP API, OAuth and MCP
Find the user API endpoints, their permissions, fields, examples and response formats.
- DELETE Permanently delete a monitor
Only the workspace owner may permanently delete a monitor. First request a five-minute configuration-bound preview, then send preview_id, confirm_deletion: true and an Idempotency-Key. Unconfirmed legacy archive requests are rejected. The monitor is immediately blocked; a durable job removes all its database, archive and cache data and cleans linked displays. Read the job until complete; paused jobs show a technical error and retry automatically. Daily quotas and security counters remain unchanged. Previously delivered messages and downloaded files cannot be recalled.
- GET Read your monitors
Read your monitors.
- POST Create a monitor with its enabled type
Create a monitor with its enabled type.