模板

查询模板

GET /v1/presets

默认每页 100 条,最多 500 条。保留筛选条件并传入 nextCursor 继续读取;分页过程中数据可能变化,完整备份请使用导出。

请求参数

archived

query · 可选

归档筛选:active、only 或 all

类型: string

完整 JSON Schema
{
  "type": "string",
  "enum": [
    "active",
    "only",
    "all"
  ]
}

projectIds

query · 可选

项目 ID 筛选;GET 用逗号分隔,POST 用数组

类型: string

完整 JSON Schema
{
  "type": "string",
  "maxLength": 8192
}

tagIds

query · 可选

标签 ID;GET 筛选用逗号分隔,正文用数组

类型: string

完整 JSON Schema
{
  "type": "string",
  "maxLength": 8192
}

tagMatch

query · 可选

标签匹配:any 或 all

类型: string

完整 JSON Schema
{
  "type": "string",
  "enum": [
    "any",
    "all"
  ]
}

noProject

query · 可选

仅匹配无项目的记录

类型: string

完整 JSON Schema
{
  "type": "string",
  "enum": [
    "true",
    "false"
  ]
}

noTags

query · 可选

仅匹配无标签的记录

类型: string

完整 JSON Schema
{
  "type": "string",
  "enum": [
    "true",
    "false"
  ]
}

includeDescendants

query · 可选

筛选时包含后代标签

类型: string

完整 JSON Schema
{
  "type": "string",
  "enum": [
    "true",
    "false"
  ]
}

limit

query · 可选

每页数量,默认 100,最多 500

类型: string

完整 JSON Schema
{
  "type": "string",
  "pattern": "^(?:[1-9][0-9]?|[1-4][0-9]{2}|500)$"
}

cursor

query · 可选

不透明游标;原样传回,不要解析

类型: string

完整 JSON Schema
{
  "type": "string",
  "maxLength": 8192
}

调用示例

将路径参数和请求参数替换为实际值。请求体按上述结构保存到 request.json。

curl --fail-with-body --request GET 'https://api.treering.cn/v1/presets' \
  --header "Authorization: Bearer $TREERING_API_TOKEN"

响应

200

成功响应;具体状态取决于操作结果。

application/json

类型: object

字段类型必填说明与约束
itemsarray<object>是资源、事件或操作结果列表
items[]object否{"additionalProperties":false}
items[].idstring是资源、任务或操作标识
items[].versionstring是版本号,十进制字符串,不要转为浮点数 {"pattern":"^(0|[1-9][0-9]*)$"}
items[].etagstring是并发版本标记;保留引号用于 If-Match
items[].updatedAtstring是服务端最后更新时间
items[].operationIdstring否请求回执标识,无需查询状态
items[].deletedAtstring否删除时间
items[].detailstring | null否记录详情
items[].detail (anyOf 1)string否
items[].detail (anyOf 2)null否
items[].projectIdstring | null否项目 ID;无项目为 null
items[].projectId (anyOf 1)string否
items[].projectId (anyOf 2)null否
items[].tagIdsarray<string>否标签 ID;GET 筛选用逗号分隔,正文用数组
items[].tagIds[]string否
items[].archiveTimestring | null否归档时间;null 表示未归档
items[].archiveTime (anyOf 1)string否
items[].archiveTime (anyOf 2)null否
items[].createTimestring | null否原始创建时间
items[].createTime (anyOf 1)string否
items[].createTime (anyOf 2)null否
items[].orderstring否客户端排序的只读序号;请在年轮客户端调整顺序 {"pattern":"^(0|[1-9][0-9]*)$"}
hasMoreboolean是是否还有下一页
nextCursorstring | null是下一页游标;末页为 null
nextCursor (anyOf 1)string否
nextCursor (anyOf 2)null否
evaluatedAtstring是服务端计算结果的时间
effectiveRangeobject | null是此次查询固定的时间范围
effectiveRange (anyOf 1)object否
effectiveRange (anyOf 1).fromstring是开始时间(含);与 to 同时提供
effectiveRange (anyOf 1).tostring是结束时间(不含);与 from 同时提供
effectiveRange (anyOf 2)null否
完整 JSON Schema
{
  "type": "object",
  "required": [
    "items",
    "hasMore",
    "nextCursor",
    "evaluatedAt",
    "effectiveRange"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "version",
          "etag",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "资源、任务或操作标识"
          },
          "version": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)$",
            "description": "版本号,十进制字符串,不要转为浮点数"
          },
          "etag": {
            "type": "string",
            "description": "并发版本标记;保留引号用于 If-Match"
          },
          "updatedAt": {
            "type": "string",
            "description": "服务端最后更新时间"
          },
          "operationId": {
            "type": "string",
            "description": "请求回执标识,无需查询状态"
          },
          "deletedAt": {
            "type": "string",
            "description": "删除时间"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "记录详情"
          },
          "projectId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "项目 ID;无项目为 null"
          },
          "tagIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "标签 ID;GET 筛选用逗号分隔,正文用数组"
          },
          "archiveTime": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "归档时间;null 表示未归档"
          },
          "createTime": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "原始创建时间"
          },
          "order": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)$",
            "description": "客户端排序的只读序号;请在年轮客户端调整顺序"
          }
        },
        "additionalProperties": false
      },
      "description": "资源、事件或操作结果列表"
    },
    "hasMore": {
      "type": "boolean",
      "description": "是否还有下一页"
    },
    "nextCursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "下一页游标;末页为 null"
    },
    "evaluatedAt": {
      "type": "string",
      "description": "服务端计算结果的时间"
    },
    "effectiveRange": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "from",
            "to"
          ],
          "properties": {
            "from": {
              "type": "string",
              "description": "开始时间(含);与 to 同时提供"
            },
            "to": {
              "type": "string",
              "description": "结束时间(不含);与 from 同时提供"
            }
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "此次查询固定的时间范围"
    }
  }
}

400, 401, 403, 404, 410, 413, 422, 429, 500, 503

错误响应;请按 code 处理。

application/json

类型: object

字段类型必填说明与约束
codestring是机器可读错误码
messagestring否错误说明;请按 code 处理程序逻辑
requestIdstring否请求追踪标识
operationIdstring否请求回执标识,无需查询状态
完整 JSON Schema
{
  "type": "object",
  "required": [
    "code"
  ],
  "properties": {
    "code": {
      "type": "string",
      "description": "机器可读错误码"
    },
    "message": {
      "type": "string",
      "description": "错误说明;请按 code 处理程序逻辑"
    },
    "requestId": {
      "type": "string",
      "description": "请求追踪标识"
    },
    "operationId": {
      "type": "string",
      "description": "请求回执标识,无需查询状态"
    }
  },
  "additionalProperties": true
}

目录