此功能為 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."
}
}完整錯誤信封說明詳見 錯誤參考。