导出

查询导出状态

GET /v1/exports/{id}

返回导出任务状态及文件信息。按 Retry-After 等待,直到 state=ready;failed 时查看 errorCode。

请求参数

id

path · 必填

资源、任务或操作标识

类型: string

完整 JSON Schema
{
  "type": "string",
  "format": "uuid"
}

调用示例

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

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

响应

200

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

application/json

类型: object

字段类型必填说明与约束
idstring是资源、任务或操作标识
statestring是记录、任务或操作状态;语义取决于接口 {"enum":["queued","building","ready","failed","expired"]}
errorCodestring | null是任务失败码;无错误时为 null
errorCode (anyOf 1)string否
errorCode (anyOf 2)null否
snapshotAtstring | null是导出数据截取时间
snapshotAt (anyOf 1)string否
snapshotAt (anyOf 2)null否
expiresAtstring | null是导出文件到期时间;尚未生成时为 null
expiresAt (anyOf 1)string否
expiresAt (anyOf 2)null否
bytesstring | null是文件字节数,十进制字符串
bytes (anyOf 1)string否{"pattern":"^(0|[1-9][0-9]*)$"}
bytes (anyOf 2)null否
sha256string | null是导出文件的 SHA-256 校验和
sha256 (anyOf 1)string否
sha256 (anyOf 2)null否
完整 JSON Schema
{
  "type": "object",
  "required": [
    "id",
    "state",
    "errorCode",
    "snapshotAt",
    "expiresAt",
    "bytes",
    "sha256"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "资源、任务或操作标识"
    },
    "state": {
      "type": "string",
      "enum": [
        "queued",
        "building",
        "ready",
        "failed",
        "expired"
      ],
      "description": "记录、任务或操作状态;语义取决于接口"
    },
    "errorCode": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "任务失败码;无错误时为 null"
    },
    "snapshotAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "导出数据截取时间"
    },
    "expiresAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "导出文件到期时间;尚未生成时为 null"
    },
    "bytes": {
      "anyOf": [
        {
          "type": "string",
          "pattern": "^(0|[1-9][0-9]*)$"
        },
        {
          "type": "null"
        }
      ],
      "description": "文件字节数,十进制字符串"
    },
    "sha256": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "导出文件的 SHA-256 校验和"
    }
  }
}

400, 401, 403, 404, 409, 410, 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
}

目录