此功能为 M3 门控特性,需要先通过 Files API 上传文件获取 file_id。
请求头
头部 | 必选 | 说明 |
| 是 |
|
| 是 |
|
路径参数
参数 | 类型 | 必选 | 说明 |
| string | 是 | Session ID( |
请求体
字段 | 类型 | 必选 | 说明 |
| array | 是 | 资源对象数组 |
| string | 是 | 取值 |
| string | 是 | 文件 ID(通过 Files API 上传后获得) |
示例请求
curl -X POST "https://api.qoder.com.cn/api/v1/cloud/sessions/sess_019e392c0d1e74e095d21ea4c6b41def/resources" \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"resources": [
{"type": "file", "file_id": "file_abc123def456"}
]
}'示例响应
HTTP 200 OK
返回更新后的 Session 对象(含新的 resources 列表)。
错误码
HTTP | type | 触发条件 |
400 |
| 请求格式错误(如 |
401 |
| PAT 无效或过期 |
404 |
| Session 或文件不存在 |
错误响应示例:
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "resources[0]: field 'type' must be one of 'file', 'github_repository'."
}
}{
"type": "error",
"error": {
"type": "not_found_error",
"message": "File 'file_fake_test_id' was not found."
}
}完整错误信封说明详见 错误参考。
该文章对您有帮助吗?