需要 read_price_rules 权限点。
更多权限点使用信息,请参考:
GET https://{handle}.myshopline.com/admin/openapi/v20220601/sales/price_rules/:price_rule_id.json
handle :店铺的唯一标识符,值为店铺域名的前缀。例如,域名为 open001.myshopline.com 的店铺,其 handleopen001
根据id查询priceRule
路径参数
  • price_rule_id string required
    优惠规则id
请求头
  • Content-Type required
    字段值固定为application/json; charset=utf-8
  • Authorization string required
    资源的访问令牌。请参考 应用授权 获取访问令牌,然后将获取到的访问令牌以 Bearer 格式传入
    Example:
    Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
响应
更多状态码信息请参考 HTTP 状态码

响应头
  • traceId
    traceId
响应体
  • price_ruleobject
    优惠规则
  • allocation_limit string
    买X得Y时,符合条件情况下可以在购物车内累计分配优惠次数的限制,例如:满1件X得1件Y的折扣方,设置allocation_limit=2,当购物车有3件X商品,3件Y商品时,仅可获得2件Y商品
  • allocation_method string
    价格规则的分配方法, 可接受的值有 ● each 折扣适用于每个参与活动商品。例如,对于优惠 15 美元的价格规则,结账时每个有资格的商品都将优惠 15 美元,此时优惠总额等于15美元乘以商品个数。● across 计算的折扣金额将应用于整个有资格的商品。例如,对于优惠 15 美元的价格规则,折扣将分摊至每个参与活动的商品上,此时优惠总额等于15美元。 当target_type值为shipping_line时,allocation_method必须为each。默认值为across
  • create_at string
    创建时间
  • ends_at string
    结束时间 ● 默认值为空 ● 如果不填则认定为没有结束时间,优惠规则无限期 ● 日期处理方式同上 ● ends_at时间不可早于starts_at时间
  • entitled_collection_ids array
    指定分类id 数组 ● 如果target_selection为entitled,则entitled_product_ids、entitled_collection_ids, entitled_variant_ids三选一必须有值 ● entitled_product_ids、entitled_collection_ids, entitled_variant_ids三个字段互斥,只可有一个字段有值
    Example: ``
  • entitled_country_ids array
    可接受多个国家/区域id
    Example: ``
  • entitled_product_ids array
    指定商品id 数组 ● 如果target_selection为entitled,则entitled_product_ids、entitled_collection_ids,entitled_variant_ids三选一必须有值 ● entitled_product_ids、entitled_collection_ids, entitled_variant_ids三个字段互斥,只可有一个字段有值,买X得Y时,表示Y商品ID列表
    Example: ``
  • entitled_variant_idsobject[]
    指定款式 数组 ● 如果target_selection为entitled,则entitled_product_ids、entitled_collection_ids, entitled_variant_ids三选一必须有值 ● entitled_product_ids、entitled_collection_ids, entitled_variant_ids三个字段互斥,只可有一个字段有值 ● 买X得Y时,表示Y商品款式列表
  • product_id string
    商品id
  • variant_id string
    款式id
  • id string
    优惠规则的ID
  • joint_discount boolean
    叠加优惠 ● 默认值为false
  • overlay_discount_code boolean
    叠加优惠-折扣码优惠,允许使多个优惠码活动叠加优惠使用
  • prerequisite_collection_ids array
    买X得Y时,X商品的分类Id列表,与prerequisite_product_ids,prerequisite_variant_ids不能同时使用
    Example: ``
  • prerequisite_customer_ids array
    指定客户 先决条件:客户必须属于由指定的客户保存的搜索之一(客户分组) requisite_saved_search_ids,或者是由requisite_customer_ids 指定的客户之一。
    Example: ``
  • prerequisite_product_ids array
    买X得Y时,买X得Y时,X商品Id列表,与prerequisite_collection_ids,prerequisite_variant_ids不会同时使用
    Example: ``
  • prerequisite_quantity_rangeobject
    优惠活动触发商品数量下限 ● prerequisite_quantity_range与 prerequisite_subtotal_range互斥 ● 若二者均为空则为无价格或数量的触发条件
  • greater_than_or_equal_to integer
    ● 可为空 ● 必须>0 ● 只可接受整数(integer)
  • prerequisite_saved_search_ids array
    指定客户组 先决条件:客户必须属于由指定的客户保存的搜索之一(客户分组) requisite_saved_search_ids,或者是由requisite_customer_ids 指定的客户之一。
    Example: ``
  • prerequisite_shipping_price_rangeobject
    运费必须小于或等于该值。 * 非必填,默认为空。 * 1)仅在target_type=shipping_line下才可以填写内容 * 2)数值,精度与店铺币种对应精度保持一致
  • less_than_or_equal_to string
    运费必须小于或等于该值。 * 非必填,默认为空。 * 1)仅在target_type=shipping_line下才可以填写内容 2)数值,精度与店铺币种对应精度保持一致
  • prerequisite_subtotal_rangeobject
    优惠活动触发订单金额下限 ● prerequisite_quantity_range与 prerequisite_subtotal_range互斥 ● 若二者均为空则为无价格或数量的触发条件
  • greater_than_or_equal_to string
    ● 可为空 ● 四舍五入保留到二位小数 例: ● 若传入11.116666,处理为11.12
  • prerequisite_to_entitlement_purchaseobject
    买X得Y时,X商品需要满足的金额门槛
  • prerequisite_amount string
    X商品需要的金额门槛,与prerequisite_quantity不能同时使用
  • prerequisite_to_entitlement_quantity_ratioobject
    买X得Y时,X商品需要的数量门槛及获得Y商品的数量
  • entitled_quantity integer
    满足1次门槛时获得Y商品的数量
  • prerequisite_quantity integer
    满足1次门槛时需要的X商品的数量,与prerequisite_quantity不能同时使用
  • prerequisite_variant_idsobject[]
    买X得Y时,X商品的款式id列表,与prerequisite_product_ids, prerequisite_collection_ids不会同时使用
  • product_id string
    商品Id
  • variant_id string
    款式id
  • starts_at string
    开始时间 ● 采用ISO 8601时间制格式,标准制格式为 ○ 2021-10-20T09:59:10+08:00 ● 如果时区未传值,则认定为GMT标准时间
  • target_selection string
    优惠规则应用范围,可接受的值有 ● all,定义为所有商品; ● entitled,定义为指定范围(指定商品/指定分类)当此字段获取entitled值时,entitled_product_ids和entitled_collection_ids两者二选一必须有值;当target_type=shipping_line时必须填all。默认值为all
  • target_type string
    价格规则适用的目标类型。 有效值: line_item:价格规则适用于购物订单商品项。 shipping_line:价格规则适用于购物订单运费项。
  • title string
    优惠规则的名称
  • update_at string
    更新时间
  • usage_limit integer
    限制该优惠规则绑定的所有优惠码的可使用总次数 ● 如果不填,默认值为null或者空,指代无限制使用次数 ● 只可接受空、自然数; ● 超出上限值自动处理为上限值
  • usage_per_customer integer
    限制每个顾客可以使用该price rule下每个code的次数 ● 如果不填,默认值为null或者空,指代无限制使用次数 ● 只可接受空、自然数; ● 超出上限值自动处理为上限值
  • value string
    优惠金额或者百分比, ● 如果value_type值是percentage,表示优惠百分比,四舍五入保留整数,例如:优惠10%,填10;● 如果value_type值是fixed_amount,表示优惠金额,单位是元,四舍五入保留两位小数,例如:优惠10.23元,填-10.23。必填字段
  • value_type string
    优惠类型,可接受的值有 ● percentage 百分比,当target_type=shipping_line时必须填percentage,买x送y类型活动必须填percentage; ● fixed_amount 固定金额;必填字段
API Explorer
https://openapiceshidianpu.myshopline.com/admin/openapi/v20220601

ParamOptions

— path required
— header required

Language

curl --request GET \
--url https://openapiceshidianpu.myshopline.com/admin/openapi/v20220601/sales/price_rules/price_rule_id.json \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw' \
--header 'Content-Type: application/json; charset=utf-8' \
--header 'accept: application/json'
Examples
通过价格规则的id获取价格规则
Response
{
"price_rule": {
"allocation_limit": 1,
"allocation_method": "each",
"create_at": "2022-12-06T18:05:19+08:00",
"ends_at": "2022-12-26T23:59:10+08:00",
"entitled_country_ids": [],
"entitled_product_ids": [
"16051760572299179531080593"
],
"id": "5704136171258910870",
"joint_discount": false,
"overlay_discount_code": false,
"prerequisite_product_ids": [
"16056751166104257221380593"
],
"prerequisite_to_entitlement_quantity_ratio": {
"entitled_quantity": 1,
"prerequisite_quantity": 2
},
"starts_at": "2022-12-15T09:00:00+08:00",
"target_selection": "entitled",
"target_type": "line_item",
"title": "Buy2iPodsGetiPodTouchForFree",
"update_at": "2022-12-06T18:05:36+08:00",
"value": "100",
"value_type": "percentage"
}
}
这篇文章对你有帮助吗?

Error loading component.

Error loading component.