订单中新增商品
POST https://{handle}.myshopline.com/admin/openapi/v20250601/orders/order_edit_add_variant.json
handle
:店铺的唯一标识符,值为店铺域名的前缀。例如,域名为 open001.myshopline.com
的店铺,其 handle
是 open001
。订单编辑-新增商品(一定会新增商品行),编辑订单为一组组合接口(开始编辑,修改商品数量,增加普通商品行,增加自定义商品行,增加商品行折扣,移除商品行折扣,订单编辑提交),需要调用编辑订单-开始接口,开启一次编辑,如果该接口调用有错误,会在返回值user_errors字段中拿到错误,调用方可以根据是否有错误进行编辑重试(注意:重试需要从order_edit_begin.json订单编辑开始接口开始进行整套编辑订单接口重新调用,重试需要控制次数)
请求头
- Content-Type required字段值固定为
application/json; charset=utf-8
- Authorization string required资源的访问令牌。请参考 应用授权 获取访问令牌,然后将获取到的访问令牌以 Bearer 格式传入Example:
Bearer eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiJmMjM3OWQyMTYyOGMzM2QxMWRiMWZkYjY5N2EzZjdjMjZlNGMwYTA5Iiwic2VsbGVySWQiOiIyMDAwMjM0ODgwIiwic3RvcmVJZCI6IjE2NzIzNjk3Mjk2MDYiLCJ2ZXJzaW9uIjoiVjIiLCJkb21haW4iOiJodHRwczovL3NsLW9wZW4tc2cubXlzaG9wbGluZS5jb20iLCJ0aW1lc3RhbXAiOjE2NzUzMTk0OTI0MzksImlzcyI6Inlzb3VsIiwiZXhwIjoxNzY5OTI3NDkyfQ.UwQzomM2veGCUaOZ0paUxq5dpc7DXuhHYFvsQ_uIAKduzWcb_j2E4q_36El83sp145D4cKbpcE5KCeeIz-JNQw
请求体
requestobject required
请求体id string required修改草稿单id,可以从调用订单编辑-开始接口返回参数中获取Example:21098923432423423423
location_id string商品仓储位置id,如果没传,则取默认的locationIdExample:5664572485024620742
quantity integer required数量Example:2
variant_id string required商品id,即skuExample:18059373523598358705063774
响应
- 200
- 401
- 429
更多状态码信息请参考 HTTP 状态码
响应头
traceId
traceId
响应体
calculated_line_itemobject
本次编辑的商品信息added_discount_staged_changeobject
商品行自定义折扣信息description string折扣描述Example:89% off
fixed_valueobject
固定金额的优惠值,支持两位小数 当折扣是固定金额类型,此项有值amount string金额,两位精度double类型字符串Example:5.99
currency_code string币种Example:USD
id string折扣idExample:6068787948765604961
percent_value string百分比的优惠值,0~1之间小数点两位,如0.2=20%off 当折扣是百分比类型,此项有值Example:0.89
id string订单编辑草稿单里的商品行idExample:6068787943765994592
original_unit_price_setobject
原价,没有应用的优惠价格presentment_moneyobject
市场币种金额信息amount string金额值,2位精度字符串Example:10.0
currency_code string币种Example:USD
shop_moneyobject
店铺币种金额信息amount string金额值,2位精度字符串Example:10.0
currency_code string币种Example:USD
quantity string数量Example:11
required_shipping boolean是否需要发货Example:true
taxable boolean是否需要计税Example:true
title string商品标题Example:normal item
variant_id string商品skuExample:18057243001210740422372124
calculated_orderobject
编辑订单草稿单信息committed boolean是否已经提交保存到订单Example:true
id string订单编辑草稿单idExample:2106068787725276328168095160459272
user_errorsobject[]
本次编辑的错误提示信息,如果执行有错误,会在此字段返回,调用方可根据错误码进行重试(注意:重试需要从order_edit.json订单编辑开始接口开始进行整套编辑订单接口重新调用)code string错误码,如果执行结果有错误,会通过此字段返回错误码,调用方可根据错误码进行重试(注意:重试需要从order_edit.json订单编辑开始接口开始进行整套编辑订单接口重新调用)Example:UNAUTHORIZED_ACCESS
field arrayThe path to the input field that caused the error. 导致错误的输入字段的路径Example:["id"]
message string错误信息Example:unauthorized access
API Explorer
调试台
这篇文章对你有帮助吗?
Error loading component.