コンテンツにスキップ
Docs
Esc
↑↓移動↵開く⌘Jプレビュー

商品の画像を設定する

必要なスコープ: products:write。multipart/form-data の file 欄に画像を1枚送る。形式は中身で判定し、申告された Content-Type は見ない。既存の画像は差し替える(URL が変わる)。

PUT/products/{product_id}/image
認証
AuthorizationBearer トークン · header必須

管理画面または CLI の cozeni login で発行したクリエイターAPIキー。購入者認証には使わない。

パスパラメーター
product_idstring必須
最小長 1 · 最大長 200
リクエストボディ
必須multipart/form-data
fileany必須

JPEG・PNG・WebP、5MBまで。

レスポンス
200

公開商品情報。リンクは別APIで取得する。

idstring必須
namestring必須
price_jpyinteger必須
currencystring必須
許可される値:jpy
recurring_intervalstring | null必須

支払いタイプ。null(省略)は買い切り、month は月額、year は年額のサブスク。作成後は変えられない。

許可される値:monthyearnull
trial_intervalstring | null必須

無料トライアルの期間の単位。trial_interval_count と両方そろえる。null(両方)でトライアルなし。定期の商品だけ。

許可される値:dayweekmonthyearnull
trial_interval_countinteger | null必須

無料トライアルの期間の長さ。上限は単位ごと(day 730・week 104・month 24・year 2)。

最小 1 · 最大 730
access_urlstring | null必須
access_typestring必須
許可される値:pagefeaturefile
metadataExternalFeatureFlagMetadata必須

機能フラグの設定値。50件まで。キーは1〜40字の英数字・_・-(proto は不可)。値は文字列(1〜500字)・数値・真偽値。URLやAPIキーなどの秘匿情報は入れない。

descriptionstring | null必須
imagesExternalProductImage[]必須
プロパティを表示
ExternalProductImage の配列
idstring必須
urlstring<uri>必須
content_typestring必須
size_bytesinteger必須
statusstring必須
許可される値:activearchived
created_atstring<date-time>必須
updated_atstring<date-time>必須
400

invalid_input。未知フィールド、無効なcursor・入力を含む。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
401

unauthorized。失効、期限切れ、環境違いを含む。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
403

insufficient_scope。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
404

product_not_found / checkout_link_not_found。他人の商品も404。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
409

idempotency_conflict / product_archived / checkout_link_disabled。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
413

image_too_large。5MB(5,242,880 バイト)を超える。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
415

unsupported_image_type。JPEG・PNG・WebP 以外(中身で判定する)。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
429

rate_limited。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
500

internal。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
503

unavailable。

errorobject必須
プロパティを表示
codestring必須
messagestring必須
request_idstring必須
リクエスト
curl -X PUT 'https://api.cozeni.net/external/v1/products/string/image' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  --form-string 'file=null'
レスポンス
{
  "id": "string",
  "name": "string",
  "price_jpy": 0,
  "currency": "jpy",
  "recurring_interval": "month",
  "trial_interval": "day",
  "trial_interval_count": 1,
  "access_url": "string",
  "access_type": "page",
  "metadata": {
    "daily_messages": 100,
    "plan": "pro",
    "beta": true
  },
  "description": "string",
  "images": [
    {
      "id": "string",
      "url": "http://example.com",
      "content_type": "string",
      "size_bytes": 0
    }
  ],
  "status": "active",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}

このページは役に立ちましたか?