Volume Pricing用API
公開APIを使って、ストアの数量割引価格ルールの一覧を取得します。
このドキュメントでは、公開APIを使って数量割引価格レコードの一覧を取得する方法を説明します。
1. エンドポイント
Section titled “1. エンドポイント”GET https://wholesale.samita.io/api/v1/volume-pricingsこのエンドポイントでは、フィルターと並べ替えのパラメーターに基づいて、数量割引価格レコードの一覧を取得できます。
2. リクエストヘッダー
Section titled “2. リクエストヘッダー”すべてのリクエストに、次の必須ヘッダーを含める必要があります。
| ヘッダー | 説明 | 必須 |
|---|---|---|
X-SAMITA-API-KEY |
Wholesaleアプリで発行されたAPIキー | はい |
X-SAMITA-SHOP-URL |
xxx.myshopify.com形式のShopifyストアドメイン |
はい |
CONTENT-TYPE |
application/jsonを指定する必要があります |
はい |
必須ヘッダーが1つでも欠けている、または無効な場合、リクエストは拒否されます。
3. リクエストパラメーター
Section titled “3. リクエストパラメーター”GETリクエストでは、次の任意のクエリパラメーターを使用できます。
a. limit
Section titled “a. limit”返されるレコードの最大数を指定します。
- 数値である必要があります
- 最小値:1
- 最大値:20
- 空欄の場合、デフォルト値は20です
例:
?limit=10b. query
Section titled “b. query”タイトルまたはIDでレコードを絞り込むための検索文字列です。
- 文字列である必要があります
- 最大長:255文字
例:
?query=pricing rulec. status
Section titled “c. status”ステータスでレコードを絞り込みます。
-
空欄にするとすべてのレコードを取得します
-
指定する場合、次の値のみ使用できます。
値 説明 active有効なレコードのみ draft下書きのレコードのみ
例:
?status=actived. sort
Section titled “d. sort”作成日時でレコードを並べ替えます。
- 空欄にできます(デフォルト:新しいレコードから順)
- 指定する場合、次のいずれかの値のみ使用できます。
descreaseascrease
例:
?sort=descreaseリクエスト全体の例
Section titled “リクエスト全体の例”GET https://wholesale.samita.io/api/v1/volume-pricings?limit=10&status=active&sort=descrease4. APIレスポンス
Section titled “4. APIレスポンス”4.1 エラーレスポンス
Section titled “4.1 エラーレスポンス”401 – Unauthorized(認証エラー)
認証に失敗した場合に返されます。
考えられる原因:
- ストアURLが指定されていない
- APIキーが指定されていない
- ストアURLが正しくない
- APIキーが正しくない
- APIキーがストアと一致しない
403 – This action is unauthorized(この操作は許可されていません)
APIキーに十分な権限がない場合に返されます。
各APIキーには、次の権限を割り当てられます。
- View(表示)
- Create(作成)
- Update(更新)
- Delete(削除)
数量割引価格一覧APIにはView権限が必要です。
429 – Too Many Requests(リクエストが多すぎます)
レート制限を超過した場合に返されます。
現在の上限:
- 最大5分あたり1リクエスト
- 最大1日あたり50リクエスト
4.2 成功レスポンス
Section titled “4.2 成功レスポンス”200 – API Success(成功)
リクエストが有効で、正常に処理された場合に返されます。
レスポンスは、数量割引価格レコードの一覧をJSON形式で返します。
成功レスポンスの例:
[ { "id": 1, "title": "New Volume Pricing", "status": true, "type": "quantity", "apply_customer": { "type": "all", "tags": [] }, "exclude_customer": { "type": "none", "tags": [] }, "apply_product": { "type": "all", "product_ids": [], "product_tags": [], "collection_ids": [], "apply_for_variants": false }, "exclude_product": { "type": "none", "product_ids": [], "collection_ids": [] }, "discount_for_variants": [ { "id": 8516448190631, "duplicated": false, "variant_pricing": true, "from_qty": "0", "from_amount": "0", "to_qty": "10", "to_amount": "0", "discount_groups": [ { "name": "all", "type": "percent", "value": "10" } ], "variants": [ { "id": 46747346763943, "duplicated": false, "from_qty": "0", "from_amount": "0", "to_qty": "10", "to_amount": "0", "discount_groups": [ { "name": "all", "type": "percent", "value": "10" } ] } ] } ], "apply_market": { "type": "all", "handle": [] }, "discount_method": "variant", "discount_groups": [ { "from_qty": "0", "from_amount": "0", "to_qty": "10", "to_amount": "0", "type": "percent", "value": "10" } ], "active_date": { "types": [], "start_at": "", "end_at": "" }, "created_at": "2026-01-15T10:00:00", "updated_at": "2026-01-15T10:00:00" }]