Wholesale Pricing 的其他 API 方法
使用公共 API 按 ID 获取或删除单条 Wholesale Pricing 记录。
本文介绍如何使用公共 API 获取和删除 Wholesale Pricing 记录。
获取 Wholesale Pricing 记录
Section titled “获取 Wholesale Pricing 记录”获取指定的 Wholesale Pricing 记录:
GET https://wholesale.samita.io/api/v1/wholesale-pricings/{id}{id}是 Wholesale Pricing 记录的 ID

- 可在应用界面中获取该 ID
- 使用 ID 时请不要包含“#”符号
示例:
GET https://wholesale.samita.io/api/v1/wholesale-pricings/12. 请求头
Section titled “2. 请求头”所有 GET 请求都必须包含以下必填请求头:
| 请求头 | 说明 | 必填 |
|---|---|---|
X-SAMITA-API-KEY |
Wholesale 应用中提供的 API 密钥 | 是 |
X-SAMITA-SHOP-URL |
Shopify 商店域名,格式为 xxx.myshopify.com | 是 |
CONTENT-TYPE |
必须为 application/json |
是 |
如果缺少其中任何请求头,请求将被拒绝。
3. 请求正文
Section titled “3. 请求正文”- GET API 不需要请求正文
- 只需提供 URL 中的
{id}参数
4. API 响应
Section titled “4. API 响应”401 – Unauthorized
身份验证失败时会出现此错误。
可能的原因:
- 缺少商店 URL
- 缺少 API 密钥
- 商店 URL 不正确
- API 密钥不正确
- API 密钥与所提供的商店不匹配
403 – This action is unauthorized
出现以下情况时会出现此错误:
- API 密钥没有 View 权限
- 所提供的 ID 不存在
- API 密钥的访问权限不足
每个 API 密钥可分配以下权限:
- View
- Create
- Update
- Delete
GET API 需要 View 权限。
429 – Too Many Requests
超出速率限制时会出现此错误。
当前限制:
- 最多 每 5 分钟 1 次请求
- 最多 每天 50 次请求
200 – API Success
- 请求有效
- 记录已成功获取
- 响应以 JSON 格式返回
示例:
{ "id": 1, "title": "New Wholesale Pricing", "status": true, "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, "variant_pricing": true, "variants": [ { "id": 46747346763943, "discount_groups": [ { "name": "all", "type": "percent", "value": "10" } ] } ] } ], "apply_market": { "type": "all", "handle": [] }, "discount_group": { "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"}删除 Wholesale Pricing 记录
Section titled “删除 Wholesale Pricing 记录”删除一条或多条现有的 Wholesale Pricing 记录:
DELETE https://wholesale.samita.io/api/v1/wholesale-pricings/{id}- URL 中的
{id}应为有效的记录 ID,但 API 实际删除的是ids参数(见下方请求正文)中列出的记录,而不是 URL 片段中的记录。
示例:
DELETE https://wholesale.samita.io/api/v1/wholesale-pricings/12. 请求头
Section titled “2. 请求头”所有 DELETE 请求都必须包含以下必填请求头:
| 请求头 | 说明 | 必填 |
|---|---|---|
X-SAMITA-API-KEY |
Wholesale 应用中提供的 API 密钥 | 是 |
X-SAMITA-SHOP-URL |
Shopify 商店域名,格式为 xxx.myshopify.com | 是 |
CONTENT-TYPE |
必须为 application/json |
是 |
3. 请求正文
Section titled “3. 请求正文”- 传入
ids参数,即要删除的记录 ID 的逗号分隔列表(可作为查询字符串参数或 JSON 正文字段)。这支持一次调用删除多条记录,例如ids=1,2,3。 - 此
ids参数为必填,缺少该参数则不会删除任何记录。 - 端点 URL 中只需提供
{id}
4. API 响应
Section titled “4. API 响应”401 – Unauthorized
身份验证失败时返回。
可能的原因:
- 缺少商店 URL
- 缺少 API 密钥
- 商店 URL 不正确
- API 密钥不正确
- API 密钥与商店不匹配
403 – This action is unauthorized
出现以下情况时会出现此错误:
- API 密钥没有 Delete 权限
- 所提供的 ID 不存在
- API 密钥的访问权限不足
DELETE API 需要 Delete 权限。
429 – Too Many Requests
请求超出允许的速率限制时返回。
速率限制:
| 限制类型 | 值 |
|---|---|
| 请求频率 | 每 5 分钟 1 次请求 |
| 每日限制 | 每天 50 次请求 |
200 – API Success
- Wholesale Pricing 记录已成功删除
- 可能不返回内容,或返回确认信息
示例:
{ "success": true}