Farbeam
Docs / API: Alert rules

Update a rule

Changes any of name, expression, url, format, cooldown_seconds and enabled. Setting enabled to true also clears the failure count.

PATCH/api/v1/rules/{id}
PropertyValue
AuthenticationRequired. Send Authorization: Bearer <key>.
Rate-limit cost1 unit
StatusLive

#Parameters

NameInTypeRequiredDescription
idpathstringYesRule id.

#Request body

JSON
{
  "enabled": false
}

#Request

curl -s -X PATCH "https://farbeamlabs.com/api/v1/rules/<id>" \
  -H "Authorization: Bearer $FARBEAM_KEY" \
  -H "content-type: application/json" \
  -d '{"enabled": false}'
const res = await fetch("https://farbeamlabs.com/api/v1/rules/<id>", {
  method: "PATCH",
  headers: { Authorization: `Bearer ${process.env.FARBEAM_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({"enabled": false})
});
const { data, meta, error } = await res.json();
if (error) throw new Error(`${error.code}: ${error.message}`);
console.log(data);
import os, requests

res = requests.patch(
    "https://farbeamlabs.com/api/v1/rules/<id>",
    headers={"Authorization": f"Bearer {os.environ['FARBEAM_KEY']}"},
    json={'enabled': False},
    timeout=30,
)
body = res.json()
if "error" in body:
    raise RuntimeError(body["error"]["code"])
print(body["data"])

You can send this request now in the API playground.

#Errors

HTTPCodeMeaning
401missing_keyThe request has no key.
404not_foundThe item does not exist.
422invalid_ruleThe expression did not parse. The message gives the position.
422invalid_urlThe webhook URL is not a public HTTPS URL.

All errors share one format. See errors.