重试创建 GitLab 触发器 webhook
curl --request POST \
--url 'https://api.flashcat.cloud/safari/automation/scm/hooks/gitlab/retry?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"rule_id": "rule_7Qm2Xc9Tb1Vk",
"trigger_id": "trg_3Kd8ZpLw"
}
'import requests
url = "https://api.flashcat.cloud/safari/automation/scm/hooks/gitlab/retry?app_key="
payload = {
"rule_id": "rule_7Qm2Xc9Tb1Vk",
"trigger_id": "trg_3Kd8ZpLw"
}
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: 'rule_7Qm2Xc9Tb1Vk', trigger_id: 'trg_3Kd8ZpLw'})
};
fetch('https://api.flashcat.cloud/safari/automation/scm/hooks/gitlab/retry?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/scm/hooks/gitlab/retry?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' => 'rule_7Qm2Xc9Tb1Vk',
'trigger_id' => 'trg_3Kd8ZpLw'
]),
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/scm/hooks/gitlab/retry?app_key="
payload := strings.NewReader("{\n \"rule_id\": \"rule_7Qm2Xc9Tb1Vk\",\n \"trigger_id\": \"trg_3Kd8ZpLw\"\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/scm/hooks/gitlab/retry?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"rule_id\": \"rule_7Qm2Xc9Tb1Vk\",\n \"trigger_id\": \"trg_3Kd8ZpLw\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/automation/scm/hooks/gitlab/retry?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\": \"rule_7Qm2Xc9Tb1Vk\",\n \"trigger_id\": \"trg_3Kd8ZpLw\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"hook_status": "active"
}
}自动化
重试创建 GitLab 触发器 webhook
重新为某个触发器创建 GitLab webhook,并返回 hook 状态。
POST
/
safari
/
automation
/
scm
/
hooks
/
gitlab
/
retry
重试创建 GitLab 触发器 webhook
curl --request POST \
--url 'https://api.flashcat.cloud/safari/automation/scm/hooks/gitlab/retry?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"rule_id": "rule_7Qm2Xc9Tb1Vk",
"trigger_id": "trg_3Kd8ZpLw"
}
'import requests
url = "https://api.flashcat.cloud/safari/automation/scm/hooks/gitlab/retry?app_key="
payload = {
"rule_id": "rule_7Qm2Xc9Tb1Vk",
"trigger_id": "trg_3Kd8ZpLw"
}
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: 'rule_7Qm2Xc9Tb1Vk', trigger_id: 'trg_3Kd8ZpLw'})
};
fetch('https://api.flashcat.cloud/safari/automation/scm/hooks/gitlab/retry?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/scm/hooks/gitlab/retry?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' => 'rule_7Qm2Xc9Tb1Vk',
'trigger_id' => 'trg_3Kd8ZpLw'
]),
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/scm/hooks/gitlab/retry?app_key="
payload := strings.NewReader("{\n \"rule_id\": \"rule_7Qm2Xc9Tb1Vk\",\n \"trigger_id\": \"trg_3Kd8ZpLw\"\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/scm/hooks/gitlab/retry?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"rule_id\": \"rule_7Qm2Xc9Tb1Vk\",\n \"trigger_id\": \"trg_3Kd8ZpLw\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/automation/scm/hooks/gitlab/retry?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\": \"rule_7Qm2Xc9Tb1Vk\",\n \"trigger_id\": \"trg_3Kd8ZpLw\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"hook_status": "active"
}
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 100 次/分钟;5 次/秒 |
| 权限要求 | Automation 管理(ai-sre) |
使用说明
- 当触发器报告
hook_status为error、或 GitLab 侧的 hook 已被删除时使用:该调用会用触发器已保存的 token 与 secret 重新注册 webhook。 - 调用方必须能管理该规则本身(规则创建者,或规则所属团队的成员),否则返回
403。 - 该操作会记入审计日志。
pending表示请求已到 GitLab 但 hook 尚未确认;deleted表示 GitLab 上已无该触发器,应改为重新保存触发器。
授权
响应
Success
所有 Flashduty 公开 API 共用的标准响应结构。成功时 data 为接口专属载荷且不含 error;失败时 error 存在而 data 缺失。request_id 始终存在,并会同步写入 Flashcat-Request-Id 响应头。
此页面对您有帮助吗?