Volume Pricing 的 API
使用公共 API 获取您商店的 Volume Pricing 规则列表。
本文介绍如何使用公共 API 获取 Volume Pricing 记录列表。
GET https://wholesale.samita.io/api/v1/volume-pricings此端点可根据筛选和排序参数获取 Volume Pricing 记录列表。
2. 请求头
Section titled “2. 请求头”所有请求都必须包含以下必填请求头:
| 请求头 | 说明 | 必填 |
|---|---|---|
X-SAMITA-API-KEY |
Wholesale 应用中提供的 API 密钥 | 是 |
X-SAMITA-SHOP-URL |
Shopify 商店域名,格式为 xxx.myshopify.com |
是 |
CONTENT-TYPE |
必须为 application/json |
是 |
如果缺少任何必填请求头或请求头无效,请求将被拒绝。
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
List Volume Pricing API 需要 View 权限。
429 – Too Many Requests
超出速率限制时返回。
当前限制:
- 最多 每 5 分钟 1 次请求
- 最多 每天 50 次请求
4.2 成功响应
Section titled “4.2 成功响应”200 – API Success
请求有效且处理成功时返回。
响应将以 JSON 格式返回 Volume Pricing 记录列表。
API 成功示例:
[ { "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" }]