创建变更
curl --request POST \
--url 'https://api.flashcat.cloud/change/create?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Upgrade payment-service to v3.2.0",
"description": "Rolling upgrade of payment-service in the production cluster.",
"change_status": "Planned",
"link": "https://ci.example.com/pipelines/4821",
"channel_id": 5001,
"labels": {
"service": "payment-service",
"env": "prod"
},
"planned_start_time": 1764147600,
"planned_end_time": 1764151200,
"operator": "alice@example.com",
"impact": "Payments may be retried for up to 30 seconds per pod.",
"backout_plan": "Roll back the deployment to v3.1.4.",
"checklist": [
{
"text": "Notify the support team",
"done": false
},
{
"text": "Verify error rate after rollout",
"done": false
}
],
"fields": {
"risk_level": "medium"
}
}
'import requests
url = "https://api.flashcat.cloud/change/create?app_key="
payload = {
"title": "Upgrade payment-service to v3.2.0",
"description": "Rolling upgrade of payment-service in the production cluster.",
"change_status": "Planned",
"link": "https://ci.example.com/pipelines/4821",
"channel_id": 5001,
"labels": {
"service": "payment-service",
"env": "prod"
},
"planned_start_time": 1764147600,
"planned_end_time": 1764151200,
"operator": "alice@example.com",
"impact": "Payments may be retried for up to 30 seconds per pod.",
"backout_plan": "Roll back the deployment to v3.1.4.",
"checklist": [
{
"text": "Notify the support team",
"done": False
},
{
"text": "Verify error rate after rollout",
"done": False
}
],
"fields": { "risk_level": "medium" }
}
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({
title: 'Upgrade payment-service to v3.2.0',
description: 'Rolling upgrade of payment-service in the production cluster.',
change_status: 'Planned',
link: 'https://ci.example.com/pipelines/4821',
channel_id: 5001,
labels: {service: 'payment-service', env: 'prod'},
planned_start_time: 1764147600,
planned_end_time: 1764151200,
operator: 'alice@example.com',
impact: 'Payments may be retried for up to 30 seconds per pod.',
backout_plan: 'Roll back the deployment to v3.1.4.',
checklist: [
{text: 'Notify the support team', done: false},
{text: 'Verify error rate after rollout', done: false}
],
fields: {risk_level: 'medium'}
})
};
fetch('https://api.flashcat.cloud/change/create?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/change/create?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([
'title' => 'Upgrade payment-service to v3.2.0',
'description' => 'Rolling upgrade of payment-service in the production cluster.',
'change_status' => 'Planned',
'link' => 'https://ci.example.com/pipelines/4821',
'channel_id' => 5001,
'labels' => [
'service' => 'payment-service',
'env' => 'prod'
],
'planned_start_time' => 1764147600,
'planned_end_time' => 1764151200,
'operator' => 'alice@example.com',
'impact' => 'Payments may be retried for up to 30 seconds per pod.',
'backout_plan' => 'Roll back the deployment to v3.1.4.',
'checklist' => [
[
'text' => 'Notify the support team',
'done' => false
],
[
'text' => 'Verify error rate after rollout',
'done' => false
]
],
'fields' => [
'risk_level' => 'medium'
]
]),
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/change/create?app_key="
payload := strings.NewReader("{\n \"title\": \"Upgrade payment-service to v3.2.0\",\n \"description\": \"Rolling upgrade of payment-service in the production cluster.\",\n \"change_status\": \"Planned\",\n \"link\": \"https://ci.example.com/pipelines/4821\",\n \"channel_id\": 5001,\n \"labels\": {\n \"service\": \"payment-service\",\n \"env\": \"prod\"\n },\n \"planned_start_time\": 1764147600,\n \"planned_end_time\": 1764151200,\n \"operator\": \"alice@example.com\",\n \"impact\": \"Payments may be retried for up to 30 seconds per pod.\",\n \"backout_plan\": \"Roll back the deployment to v3.1.4.\",\n \"checklist\": [\n {\n \"text\": \"Notify the support team\",\n \"done\": false\n },\n {\n \"text\": \"Verify error rate after rollout\",\n \"done\": false\n }\n ],\n \"fields\": {\n \"risk_level\": \"medium\"\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/change/create?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Upgrade payment-service to v3.2.0\",\n \"description\": \"Rolling upgrade of payment-service in the production cluster.\",\n \"change_status\": \"Planned\",\n \"link\": \"https://ci.example.com/pipelines/4821\",\n \"channel_id\": 5001,\n \"labels\": {\n \"service\": \"payment-service\",\n \"env\": \"prod\"\n },\n \"planned_start_time\": 1764147600,\n \"planned_end_time\": 1764151200,\n \"operator\": \"alice@example.com\",\n \"impact\": \"Payments may be retried for up to 30 seconds per pod.\",\n \"backout_plan\": \"Roll back the deployment to v3.1.4.\",\n \"checklist\": [\n {\n \"text\": \"Notify the support team\",\n \"done\": false\n },\n {\n \"text\": \"Verify error rate after rollout\",\n \"done\": false\n }\n ],\n \"fields\": {\n \"risk_level\": \"medium\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/change/create?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 \"title\": \"Upgrade payment-service to v3.2.0\",\n \"description\": \"Rolling upgrade of payment-service in the production cluster.\",\n \"change_status\": \"Planned\",\n \"link\": \"https://ci.example.com/pipelines/4821\",\n \"channel_id\": 5001,\n \"labels\": {\n \"service\": \"payment-service\",\n \"env\": \"prod\"\n },\n \"planned_start_time\": 1764147600,\n \"planned_end_time\": 1764151200,\n \"operator\": \"alice@example.com\",\n \"impact\": \"Payments may be retried for up to 30 seconds per pod.\",\n \"backout_plan\": \"Roll back the deployment to v3.1.4.\",\n \"checklist\": [\n {\n \"text\": \"Notify the support team\",\n \"done\": false\n },\n {\n \"text\": \"Verify error rate after rollout\",\n \"done\": false\n }\n ],\n \"fields\": {\n \"risk_level\": \"medium\"\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"change_id": "664a1b2c3d4e5f6a7b8c9d0e",
"change_key": "CHG-20261126-7Q2K"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter 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."
}
}变更管理
创建变更
在协作空间中创建一条变更。变更记为调用方写入,变更键由平台生成。
POST
/
change
/
create
创建变更
curl --request POST \
--url 'https://api.flashcat.cloud/change/create?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Upgrade payment-service to v3.2.0",
"description": "Rolling upgrade of payment-service in the production cluster.",
"change_status": "Planned",
"link": "https://ci.example.com/pipelines/4821",
"channel_id": 5001,
"labels": {
"service": "payment-service",
"env": "prod"
},
"planned_start_time": 1764147600,
"planned_end_time": 1764151200,
"operator": "alice@example.com",
"impact": "Payments may be retried for up to 30 seconds per pod.",
"backout_plan": "Roll back the deployment to v3.1.4.",
"checklist": [
{
"text": "Notify the support team",
"done": false
},
{
"text": "Verify error rate after rollout",
"done": false
}
],
"fields": {
"risk_level": "medium"
}
}
'import requests
url = "https://api.flashcat.cloud/change/create?app_key="
payload = {
"title": "Upgrade payment-service to v3.2.0",
"description": "Rolling upgrade of payment-service in the production cluster.",
"change_status": "Planned",
"link": "https://ci.example.com/pipelines/4821",
"channel_id": 5001,
"labels": {
"service": "payment-service",
"env": "prod"
},
"planned_start_time": 1764147600,
"planned_end_time": 1764151200,
"operator": "alice@example.com",
"impact": "Payments may be retried for up to 30 seconds per pod.",
"backout_plan": "Roll back the deployment to v3.1.4.",
"checklist": [
{
"text": "Notify the support team",
"done": False
},
{
"text": "Verify error rate after rollout",
"done": False
}
],
"fields": { "risk_level": "medium" }
}
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({
title: 'Upgrade payment-service to v3.2.0',
description: 'Rolling upgrade of payment-service in the production cluster.',
change_status: 'Planned',
link: 'https://ci.example.com/pipelines/4821',
channel_id: 5001,
labels: {service: 'payment-service', env: 'prod'},
planned_start_time: 1764147600,
planned_end_time: 1764151200,
operator: 'alice@example.com',
impact: 'Payments may be retried for up to 30 seconds per pod.',
backout_plan: 'Roll back the deployment to v3.1.4.',
checklist: [
{text: 'Notify the support team', done: false},
{text: 'Verify error rate after rollout', done: false}
],
fields: {risk_level: 'medium'}
})
};
fetch('https://api.flashcat.cloud/change/create?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/change/create?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([
'title' => 'Upgrade payment-service to v3.2.0',
'description' => 'Rolling upgrade of payment-service in the production cluster.',
'change_status' => 'Planned',
'link' => 'https://ci.example.com/pipelines/4821',
'channel_id' => 5001,
'labels' => [
'service' => 'payment-service',
'env' => 'prod'
],
'planned_start_time' => 1764147600,
'planned_end_time' => 1764151200,
'operator' => 'alice@example.com',
'impact' => 'Payments may be retried for up to 30 seconds per pod.',
'backout_plan' => 'Roll back the deployment to v3.1.4.',
'checklist' => [
[
'text' => 'Notify the support team',
'done' => false
],
[
'text' => 'Verify error rate after rollout',
'done' => false
]
],
'fields' => [
'risk_level' => 'medium'
]
]),
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/change/create?app_key="
payload := strings.NewReader("{\n \"title\": \"Upgrade payment-service to v3.2.0\",\n \"description\": \"Rolling upgrade of payment-service in the production cluster.\",\n \"change_status\": \"Planned\",\n \"link\": \"https://ci.example.com/pipelines/4821\",\n \"channel_id\": 5001,\n \"labels\": {\n \"service\": \"payment-service\",\n \"env\": \"prod\"\n },\n \"planned_start_time\": 1764147600,\n \"planned_end_time\": 1764151200,\n \"operator\": \"alice@example.com\",\n \"impact\": \"Payments may be retried for up to 30 seconds per pod.\",\n \"backout_plan\": \"Roll back the deployment to v3.1.4.\",\n \"checklist\": [\n {\n \"text\": \"Notify the support team\",\n \"done\": false\n },\n {\n \"text\": \"Verify error rate after rollout\",\n \"done\": false\n }\n ],\n \"fields\": {\n \"risk_level\": \"medium\"\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/change/create?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Upgrade payment-service to v3.2.0\",\n \"description\": \"Rolling upgrade of payment-service in the production cluster.\",\n \"change_status\": \"Planned\",\n \"link\": \"https://ci.example.com/pipelines/4821\",\n \"channel_id\": 5001,\n \"labels\": {\n \"service\": \"payment-service\",\n \"env\": \"prod\"\n },\n \"planned_start_time\": 1764147600,\n \"planned_end_time\": 1764151200,\n \"operator\": \"alice@example.com\",\n \"impact\": \"Payments may be retried for up to 30 seconds per pod.\",\n \"backout_plan\": \"Roll back the deployment to v3.1.4.\",\n \"checklist\": [\n {\n \"text\": \"Notify the support team\",\n \"done\": false\n },\n {\n \"text\": \"Verify error rate after rollout\",\n \"done\": false\n }\n ],\n \"fields\": {\n \"risk_level\": \"medium\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/change/create?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 \"title\": \"Upgrade payment-service to v3.2.0\",\n \"description\": \"Rolling upgrade of payment-service in the production cluster.\",\n \"change_status\": \"Planned\",\n \"link\": \"https://ci.example.com/pipelines/4821\",\n \"channel_id\": 5001,\n \"labels\": {\n \"service\": \"payment-service\",\n \"env\": \"prod\"\n },\n \"planned_start_time\": 1764147600,\n \"planned_end_time\": 1764151200,\n \"operator\": \"alice@example.com\",\n \"impact\": \"Payments may be retried for up to 30 seconds per pod.\",\n \"backout_plan\": \"Roll back the deployment to v3.1.4.\",\n \"checklist\": [\n {\n \"text\": \"Notify the support team\",\n \"done\": false\n },\n {\n \"text\": \"Verify error rate after rollout\",\n \"done\": false\n }\n ],\n \"fields\": {\n \"risk_level\": \"medium\"\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"change_id": "664a1b2c3d4e5f6a7b8c9d0e",
"change_key": "CHG-20261126-7Q2K"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter 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 即可调用 |
使用说明
channel_id必须是本账户的协作空间,否则返回InvalidParameter。调用方须有权在该空间写入变更:账户所有者或管理员、该空间的创建者、其所属团队或管理团队的成员;公开协作空间则所有成员均可。否则返回AccessDenied。change_status默认为Planned;创建时可设为六种状态中的任意一种。- 返回的
change_key格式为CHG-<yyyyMMdd>-<4 位字符>。如需用自己系统的键定位变更,请改用变更集成推送。 planned_start_time和planned_end_time接受 Unix 秒或毫秒(毫秒会按秒保存);planned_end_time不能早于planned_start_time。link须为空,或为完整的http/https地址。- 标签键不符合
[a-zA-Z_][a-zA-Z0-9_]*时,其中的空格和标点会被替换为_后保存。 fields的每个键都必须是已启用、且可用于变更的自定义字段,取值须符合该字段的类型和选项;否则返回InvalidParameter,并指明fields.<字段名>。- 账户变更表单中的必填字段(包括按条件必填的字段)必须填写,否则返回
InvalidParameter,信息为required fields missing or empty: <字段键>。 checklist中的by和at会被忽略:done为true的清单项记为调用方在本次调用时勾选。- 变更表单为该协作空间绑定了通知群组时,会向该群组发送通知。
- 每次调用都会记录到账户审计日志。
授权
请求体
application/json
此页面对您有帮助吗?