curl --request POST \
--url 'https://api.flashcat.cloud/safari/automation/rule/update?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
"enabled": true,
"cron_expr": "15 9 * * 1",
"rotate_http_post_trigger_token": true,
"oncall_incident_trigger_enabled": true,
"oncall_incident_severities": [
"Critical",
"Warning"
],
"oncall_incident_channel_ids": [
456
]
}
'import requests
url = "https://api.flashcat.cloud/safari/automation/rule/update?app_key="
payload = {
"rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
"enabled": True,
"cron_expr": "15 9 * * 1",
"rotate_http_post_trigger_token": True,
"oncall_incident_trigger_enabled": True,
"oncall_incident_severities": ["Critical", "Warning"],
"oncall_incident_channel_ids": [456]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
rule_id: 'arule_7NnLzY2Qp8xS4kUaV3mR6b',
enabled: true,
cron_expr: '15 9 * * 1',
rotate_http_post_trigger_token: true,
oncall_incident_trigger_enabled: true,
oncall_incident_severities: ['Critical', 'Warning'],
oncall_incident_channel_ids: [456]
})
};
fetch('https://api.flashcat.cloud/safari/automation/rule/update?app_key=', 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.flashcat.cloud/safari/automation/rule/update?app_key=",
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([
'rule_id' => 'arule_7NnLzY2Qp8xS4kUaV3mR6b',
'enabled' => true,
'cron_expr' => '15 9 * * 1',
'rotate_http_post_trigger_token' => true,
'oncall_incident_trigger_enabled' => true,
'oncall_incident_severities' => [
'Critical',
'Warning'
],
'oncall_incident_channel_ids' => [
456
]
]),
CURLOPT_HTTPHEADER => [
"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.flashcat.cloud/safari/automation/rule/update?app_key="
payload := strings.NewReader("{\n \"rule_id\": \"arule_7NnLzY2Qp8xS4kUaV3mR6b\",\n \"enabled\": true,\n \"cron_expr\": \"15 9 * * 1\",\n \"rotate_http_post_trigger_token\": true,\n \"oncall_incident_trigger_enabled\": true,\n \"oncall_incident_severities\": [\n \"Critical\",\n \"Warning\"\n ],\n \"oncall_incident_channel_ids\": [\n 456\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.flashcat.cloud/safari/automation/rule/update?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"rule_id\": \"arule_7NnLzY2Qp8xS4kUaV3mR6b\",\n \"enabled\": true,\n \"cron_expr\": \"15 9 * * 1\",\n \"rotate_http_post_trigger_token\": true,\n \"oncall_incident_trigger_enabled\": true,\n \"oncall_incident_severities\": [\n \"Critical\",\n \"Warning\"\n ],\n \"oncall_incident_channel_ids\": [\n 456\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/automation/rule/update?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"rule_id\": \"arule_7NnLzY2Qp8xS4kUaV3mR6b\",\n \"enabled\": true,\n \"cron_expr\": \"15 9 * * 1\",\n \"rotate_http_post_trigger_token\": true,\n \"oncall_incident_trigger_enabled\": true,\n \"oncall_incident_severities\": [\n \"Critical\",\n \"Warning\"\n ],\n \"oncall_incident_channel_ids\": [\n 456\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
"account_id": 10023,
"team_id": 123,
"owner_id": 80011,
"name": "Weekly on-call review",
"enabled": true,
"run_scope": "team",
"cron_expr": "0 9 * * 1",
"timezone": "Asia/Shanghai",
"prompt": "Summarize last week's alert noise and escalation load.",
"environment_kind": "",
"environment_id": "",
"schedule_trigger_id": "atrig_6aKp3wT9mQ2xVc8bR1nY7z",
"schedule_trigger_enabled": true,
"http_post_trigger_id": "atrig_2bLq4xT8mP1sWd9cN3rF6y",
"http_post_trigger_url": "/safari/automation/triggers/atrig_2bLq4xT8mP1sWd9cN3rF6y/fire",
"http_post_trigger_enabled": true,
"can_edit": true,
"created_at": 1780367971228,
"updated_at": 1780367971228,
"http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U",
"schedule_next_fire_at_ms": 1780630800000,
"oncall_incident_trigger_id": "atrig_9cVb2mN7qKs4dEa8T1rY5p",
"oncall_incident_trigger_enabled": true,
"oncall_incident_channel_ids": [
456
],
"oncall_incident_severities": [
"Critical",
"Warning"
]
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter skill_id is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "AccessDenied",
"message": "Access Denied."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}更新自动化规则
更新自动化规则的可变字段,包括 HTTP POST 与 On-call 故障触发器配置。
curl --request POST \
--url 'https://api.flashcat.cloud/safari/automation/rule/update?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
"enabled": true,
"cron_expr": "15 9 * * 1",
"rotate_http_post_trigger_token": true,
"oncall_incident_trigger_enabled": true,
"oncall_incident_severities": [
"Critical",
"Warning"
],
"oncall_incident_channel_ids": [
456
]
}
'import requests
url = "https://api.flashcat.cloud/safari/automation/rule/update?app_key="
payload = {
"rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
"enabled": True,
"cron_expr": "15 9 * * 1",
"rotate_http_post_trigger_token": True,
"oncall_incident_trigger_enabled": True,
"oncall_incident_severities": ["Critical", "Warning"],
"oncall_incident_channel_ids": [456]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
rule_id: 'arule_7NnLzY2Qp8xS4kUaV3mR6b',
enabled: true,
cron_expr: '15 9 * * 1',
rotate_http_post_trigger_token: true,
oncall_incident_trigger_enabled: true,
oncall_incident_severities: ['Critical', 'Warning'],
oncall_incident_channel_ids: [456]
})
};
fetch('https://api.flashcat.cloud/safari/automation/rule/update?app_key=', 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.flashcat.cloud/safari/automation/rule/update?app_key=",
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([
'rule_id' => 'arule_7NnLzY2Qp8xS4kUaV3mR6b',
'enabled' => true,
'cron_expr' => '15 9 * * 1',
'rotate_http_post_trigger_token' => true,
'oncall_incident_trigger_enabled' => true,
'oncall_incident_severities' => [
'Critical',
'Warning'
],
'oncall_incident_channel_ids' => [
456
]
]),
CURLOPT_HTTPHEADER => [
"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.flashcat.cloud/safari/automation/rule/update?app_key="
payload := strings.NewReader("{\n \"rule_id\": \"arule_7NnLzY2Qp8xS4kUaV3mR6b\",\n \"enabled\": true,\n \"cron_expr\": \"15 9 * * 1\",\n \"rotate_http_post_trigger_token\": true,\n \"oncall_incident_trigger_enabled\": true,\n \"oncall_incident_severities\": [\n \"Critical\",\n \"Warning\"\n ],\n \"oncall_incident_channel_ids\": [\n 456\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.flashcat.cloud/safari/automation/rule/update?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"rule_id\": \"arule_7NnLzY2Qp8xS4kUaV3mR6b\",\n \"enabled\": true,\n \"cron_expr\": \"15 9 * * 1\",\n \"rotate_http_post_trigger_token\": true,\n \"oncall_incident_trigger_enabled\": true,\n \"oncall_incident_severities\": [\n \"Critical\",\n \"Warning\"\n ],\n \"oncall_incident_channel_ids\": [\n 456\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/automation/rule/update?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"rule_id\": \"arule_7NnLzY2Qp8xS4kUaV3mR6b\",\n \"enabled\": true,\n \"cron_expr\": \"15 9 * * 1\",\n \"rotate_http_post_trigger_token\": true,\n \"oncall_incident_trigger_enabled\": true,\n \"oncall_incident_severities\": [\n \"Critical\",\n \"Warning\"\n ],\n \"oncall_incident_channel_ids\": [\n 456\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"rule_id": "arule_7NnLzY2Qp8xS4kUaV3mR6b",
"account_id": 10023,
"team_id": 123,
"owner_id": 80011,
"name": "Weekly on-call review",
"enabled": true,
"run_scope": "team",
"cron_expr": "0 9 * * 1",
"timezone": "Asia/Shanghai",
"prompt": "Summarize last week's alert noise and escalation load.",
"environment_kind": "",
"environment_id": "",
"schedule_trigger_id": "atrig_6aKp3wT9mQ2xVc8bR1nY7z",
"schedule_trigger_enabled": true,
"http_post_trigger_id": "atrig_2bLq4xT8mP1sWd9cN3rF6y",
"http_post_trigger_url": "/safari/automation/triggers/atrig_2bLq4xT8mP1sWd9cN3rF6y/fire",
"http_post_trigger_enabled": true,
"can_edit": true,
"created_at": 1780367971228,
"updated_at": 1780367971228,
"http_post_token": "sat_yQ9p8V7n6M5k4J3h2G1f0E9d8C7b6A5z4Y3x2W1v0U",
"schedule_next_fire_at_ms": 1780630800000,
"oncall_incident_trigger_id": "atrig_9cVb2mN7qKs4dEa8T1rY5p",
"oncall_incident_trigger_enabled": true,
"oncall_incident_channel_ids": [
456
],
"oncall_incident_severities": [
"Critical",
"Warning"
]
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter skill_id is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "AccessDenied",
"message": "Access Denied."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 300 次/分钟;20 次/秒 |
| 权限要求 | 有效 app_key;管理操作要求调用者可管理目标规则 |
使用说明
- 省略或传
null的字段保持不变;team_id不能修改为与当前值不同的值。 cron_expr与timezone可以分别更新——只传其中一个时,另一个保持当前已存储的值。rotate_http_post_trigger_token=true会签发新的 webhook token,且仅在本次响应中返回。- 如需由 On-call 故障触发,传入
oncall_incident_trigger_enabled、oncall_incident_channel_ids与oncall_incident_severities;匹配事件会以trigger_kind=oncall_incident运行。 - 每次调用都会记录到账户审计日志。
授权
App key issued from the Flashduty console. Required on every public API call. Keep it secret — it grants the same access as the owning account.
请求体
更新自动化规则。字段省略或传 null 表示不修改。
目标规则 ID。
新规则名称。
255只允许传当前值;创建后 personal / team scope 不可修改。
x >= 0是否启用规则。
运行周期。支持 4 段 hour day month weekday,会补 minute=0;也支持 5 段 minute hour day month weekday。分钟必须是固定整数,秒级 6 段不支持。
"15 9 * * *"
更新 cron_expr 所用的 IANA 时区。省略或传 null 表示保持当前时区不变。
是否启用 schedule trigger。
新的任务提示词。
运行环境类型。省略或空字符串表示自动选择。
, cloud, byoc BYOC Runner ID。
是否启用 HTTP POST trigger。不存在时设为 true 会创建。
是否启用 On-call 故障触发器。
监听的 On-call 集成 ID 列表;创建或启用该触发器时至少需要一个有效 ID。
x >= 1监听的故障严重程度,支持 Critical、Warning 和 Info;创建或启用该触发器时至少需要一个值。
Critical, Warning, Info 是否轮换 HTTP POST trigger token。新 token 只会在本次响应中返回。
响应
Success
Standard response envelope used by every Flashduty public API. On success data contains the endpoint-specific payload and error is absent. On failure error is present and data is absent. request_id is always present and is also mirrored in the Flashcat-Request-Id response header.
Unique ID for this request. Mirrored in the Flashcat-Request-Id header. Include it when reporting issues.
"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"
Error payload inside the response envelope. Present only on non-2xx responses.
Show child attributes
Show child attributes
自动化规则。
Show child attributes
Show child attributes
此页面对您有帮助吗?