查询刺绣任务接口
接口概述
根据创建刺绣任务接口返回的任务 ID,查询任务状态、DST 文件和效果图。
| 网络协议 | 请求地址 | 请求方法 | 鉴权方式 | 响应格式 |
|---|---|---|---|---|
| HTTPS | /open-api/v1/embroidery/query-task | GET | Bearer | application/json |
请求头(Headers)
| 参数名称 | 值 | 描述 |
|---|---|---|
| Authorization | Bearer | 与创建任务接口使用相同的鉴权方式 |
请求参数(HTTP GET)
| 参数名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| task_id | string | 是 | 创建刺绣任务接口返回的任务 ID |
响应体(Response)
| 参数名称 | 子字段 | 类型 | 描述 |
|---|---|---|---|
| code | - | int | 200 表示查询成功,生成结果须检查 state |
| data | task_id | string | 任务 ID |
| state | string | created:已创建;queueing:排队中;processing:处理中;success:成功;failed:失败 | |
| id | string | 成功生成的资源 ID | |
| url | string | 成功后的 DST 文件下载 URL | |
| cover_url | string | 成功后的效果图 URL | |
| msg | - | string | 响应信息 |
仅在 state=success 后读取结果地址;其他状态下结果字段可能为空或省略。state=failed 时停止轮询,code 仍可能为 200。下载地址可能带有签名,请保留完整 URL 并及时下载;过期后重新查询获取地址。其他模型格式字段不作为本接口输出。
响应示例
json
{
"code": 200,
"data": {
"task_id": "embroidery_example_task",
"state": "success",
"id": "embroidery_example_asset",
"url": "https://example.com/result.dst",
"cover_url": "https://example.com/preview.png"
},
"msg": "success"
}任务失败时:
json
{"code":200,"data":{"task_id":"embroidery_example_task","state":"failed"},"msg":"success"}请求示例(Shell)
shell
curl --location 'https://api.hitem3d.ai/open-api/v1/embroidery/query-task?task_id=embroidery_example_task' \
--header 'Authorization: Bearer {{token}}'