すべてのプロダクト
Search
ドキュメントセンター

Qoder CN シリーズ:セッションへのリソースの追加

最終更新日:Jul 04, 2026

アップロード済みのファイルまたは GitHub リポジトリを、既存のセッションにリソースとしてアタッチします。

注意事項

この機能は M3 ゲート制御されています。まず Files API を使用してファイルをアップロードし、file_id を取得してください。

パスパラメーター

パラメーター タイプ 説明
session_id string sess_ プレフィックスが付いたセッション ID

リクエストヘッダー

ヘッダー 必須 説明
Authorization はい Bearer $QODER_PAT
Content-Type はい application/json

リクエストボディ

フィールド タイプ 必須 説明
resources array はい リソースオブジェクトの配列
resources[].type string はい "file""github_repository" のいずれか
resources[].file_id string はい Files API から取得したファイル ID

リクエスト例

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

新しい resources リストを含む更新済みのセッションオブジェクトが返されます。

エラー

HTTP タイプ トリガー
400 invalid_request_error 不正なリクエスト (例:type"file" または "github_repository" ではない、または file_id が欠落している)
401 authentication_error PAT が無効または期限切れ
404 not_found_error セッションまたはファイルが存在しない

エラーレスポンス例

無効な type

{
  "error": {
    "message": "resources[0]: field 'type' must be one of 'file', 'github_repository'.",
    "type": "invalid_request_error"
  },
  "type": "error"
}

file_id の欠落:

{
  "error": {
    "message": "resources[0]: field 'file_id' must be a non-empty string.",
    "type": "invalid_request_error"
  },
  "type": "error"
}

ファイルが見つからない:

{
  "error": {
    "message": "File 'file_fake_test_id' was not found.",
    "type": "not_found_error"
  },
  "type": "error"
}

エラーエンベロープの詳細については、エラーのセクションを参照してください。