POST /v1/items/{id}/images
scope
write_items
リクエストパラメーター
| 名前 | 位置 | 型 | 必須 | 説明 |
|---|---|---|---|---|
id | パス | integer | 必須 | |
Idempotency-Key | ヘッダー | string | 必須 | 冪等キー(必須・ADR-010) |
source_url | ボディ | string | 必須 | 画像の取得元 URL(https のみ・jpeg/png・2MB まで。実バイトで MIME 判定) |
type | ボディ | enum(main | additional) | 任意 |
orientation | ボディ | enum(landscape | square) | 任意 |
レスポンスの例
{
"item_id": "string",
"type": "main",
"key": "string",
"url": "string",
"sort": 0,
"orientation": "landscape"
}
解説
商品画像を URL 指定で登録・差し替えます。source_url(https のみ)から画像を取得し、実バイトで JPEG / PNG を判定(拡張子ではなく中身で検証・2MB まで)して既存の商品画像ストレージに保存します。type: main はメイン画像の差し替え(orientation で向きも変更可)、type: additional は追加画像として末尾に追加されます。画像を設定すると商品を active(公開)にできるようになります。Idempotency-Key 必須。
エラーレスポンスの例
{
"error": {
"code": "insufficient_scope",
"message": "requires scope 'read_orders'",
"request_id": "req_01H..."
}
}
返しうるエラー: 400 / 401 / 403 / 404 / 422 / 503