查询:任务结果
简洁描述:查询图片处理任务的执行状态与结果文件信息。
概览
- 请求方法:
GET - 路径:
/task/{task_id} - 内容类型:
application/json
认证方式
- Header:
Authorization: Bearer <token>
请求示例
路径参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| task_id | string | 是 | 任务 ID,例如 28e9810b-ca6a-4c0d-8af2-13aa1a48949c |
curl 示例
bash
curl -X GET "https://api.gpt.ge/task/28e9810b-ca6a-4c0d-8af2-13aa1a48949c" \
-H "Authorization: Bearer sk-xxxx"JavaScript (fetch) 示例
javascript
fetch('https://api.gpt.ge/task/28e9810b-ca6a-4c0d-8af2-13aa1a48949c', {
method: 'GET',
headers: {
'Authorization': 'Bearer sk-xxxx'
}
}).then(r => r.json()).then(console.log);Python(requests)示例
python
import requests
response = requests.get(
'https://api.gpt.ge/task/28e9810b-ca6a-4c0d-8af2-13aa1a48949c',
headers={'Authorization': 'Bearer sk-xxxx'}
)
print(response.json())返回示例(200)
json
{
"status": 200,
"data": {
"mask": "",
"image": "https://wxtechsz.oss-cn-shenzhen.aliyuncs.com/tasks/output/segmentation/28e9810b-ca6a-4c0d-8af2-13aa1a48949c-image.png",
"state": 1,
"task_id": "28e9810b-ca6a-4c0d-8af2-13aa1a48949c",
"progress": 100,
"created_at": 1742668552,
"completed_at": 1742668553,
"processed_at": 1742668552
}
}注意:仅对异步任务或
sync=0的请求使用本接口查询结果;当state=1表示任务完成,可停止轮询。