检查点:创建检查点
路由 URL
POST https://playcanvas.com/api/checkpoints
说明
启动为分支创建检查点的任务。检查点保存分支当前状态,以便以后恢复。
请求会立即返回任务详情。可以按 ID 轮询任务,直至状态为 complete 或 error。完成后,任务数据将包含创建的检查点。
示例
curl -H "Authorization: Bearer {accessToken}" -H "Content-Type: application/json" -X POST -d '{"projectId": {projectId}, "branchId": "{branchId}", "description": "My checkpoint"}' "https://playcanvas.com/api/checkpoints"
HTTP 请求
POST https://playcanvas.com/api/checkpoints
Authorization: Bearer {accessToken}
Content-Type: application/json
{
"projectId": {projectId},
"branchId": "{branchId}",
"description": "My checkpoint"
}
参数
| 名称 | 类型 | 必需 | 说明 |
|---|---|---|---|
projectId | number | ✔️ | 项目 ID。 |
branchId | string | ✔️ | 分支 ID。 |
description | string | ✔️ | 检查点描述,不能为空,且不得超过 10,000 个字符。 |
响应结构
Status: 201 Created
{
"id": int,
"created_at": date,
"modified_at": date,
"status": "running" | "complete" | "error",
"messages": list of strings,
"data": {
"type": "checkpoint_create",
"project_id": int,
"branch_id": string,
"user_id": int,
"user": {
"id": int,
"fullName": string,
"username": string
},
"description": string
}
}
任务完成时,data 字段包含创建的检查点:
{
"id": string,
"user": {
"id": int,
"fullName": string,
"username": string
},
"createdAt": date,
"description": string
}
错误
| 状态码 | 说明 |
|---|---|
| 400 | 请求无效 |
| 401 | 未通过身份验证 |
| 403 | 禁止访问 |
| 404 | 未找到项目/分支 |
| 429 | 请求过多 |
请求限流
此路由采用普通限流。