开放 API
使用说明
获取授权
全部 API
- Shop
- Metafields
- Customer
- CustomerAddress
- Account
- Product
- ProductVariant
- ProductImage
- Theme
- Asset
- Country
- Province
- City
- District
- ScriptTag
- Order
- Shipment
- ShipmentSupplier
- Payment
- PaymentMethod
- Redirect
- Page
- Webhook
- Blog
- BlogAuthor
- CustomerLevel
- StoreFile
- Promotion
- Coupon
- Post
- AfterSale
Shipment
Shipment
Shipment 为订单的运单,可以通过 API 指定 ShipmentSupplier 物流供应商,设置运单号并设置发货。
Shipment 对象支持 Webhook。
Shipment 相关API
Shipment 属性
- amount
Price 类型,Shipment 的运费金额(订单生成时计算)。{ "amount": 0.01 }
- dis_type
Number 类型,运单的发货类型 0:普通快递 1:保税仓 2:海外直邮。{ "dis_type": 0 }
- auto_received_at
Datetime 类型,Shipment 的自动签收时间(当运单发货前为 null;发货后,会自动设定发货的 2 周后自动签收)。{ "auto_received_at": "2014-09-01T00:00:01.987+08:00" }
- created_at
Datetime 类型,Shipment 的创建时间。{ "created_at": "2014-09-01T00:00:01.987+08:00" }
- id
Number 类型,Shipment 的唯一整型标识。{ "id": 326 }
- items
Array 类型,Shipment 的运单商品列表。{ "items": [ { "created_at": "2015-04-29T21:18:28.124+08:00", "id": 387, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 128, "position": 0, "product_id": 143, "src": "http://asset.localtestasset.com/image/53faef5b6387e448ad0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅在线支付 - 顺丰)", "options_desc": "颜色:地地道道", "price": 1, "quantity": 1, "updated_at": "2015-04-29T21:18:28.124+08:00", "volume": 0, "weight": 0 } ] }
- ship_no
String 类型,Shipment 的物流配送单号,用于系统和顾客追踪包裹物流配送状态。{ "ship_no" : "204997145429" }
- ship_type
String 类型,该运单的配送方式,包括:{ "ship_type": "sf-express" }
- express:普通物流
- sf-express:顺丰速递
- ems:EMS
- surfacemail:平邮
- self-shipping:商家配送
- customer-fetch:上门自取
- shipment_supplier
Object 类型,Shipment 的ShipmentSupplier 物流供应商。{ "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" } }
- status
String 类型,Shipment 的状态,包括:{ "status": "pending" }
- pending:等待配送
- send:配送中
- recieve:已签收
- updated_at
Datetime 类型,Order 的最近一次修改时间。{ "updated_at": "2015-01-25T22:31:06.155+08:00" }
GET /shipments
获取 Shipment 列表
- limit
- 显示条数(默认10,最大50)
- page
- 显示页码(默认1)
- since_id
- 筛选
id
大于since_id
的Order
- fields
- 以
,
拼接Response显示的字段
- id
- 查询指定
id
- ids
- 以
,
拼接要显示的id
范围
- order_id
- 查询指定
order_id
- order_ids
- 以
,
拼接要显示的order_id
范围
- status
- 缺省筛选包含输入
status
值的Shipment
- created_at_min
- 缺省筛选创建时间在指定日期时间之后的Shipment(格式2014-09-01T01:00:01)
- created_at_max
- 缺省筛选创建时间在指定日期时间之前的Shipment(格式2014-09-01T01:00:01)
- updated_at_min
- 缺省筛选更新时间在指定日期时间之后的Shipment(格式2014-09-01T01:00:01)
- updated_at_max
- 缺省筛选更新时间在指定日期时间之前的Shipment(格式2014-09-01T01:00:01)
- 获取Shipment列表
- GET /shipments
{ "shipments": [ { "amount": 16, "auto_received_at": "2015-05-29T03:00:00.000+08:00", "created_at": "2015-04-29T21:18:28.124+08:00", "id": 359, "items": [ { "created_at": "2015-04-29T21:18:28.124+08:00", "id": 387, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 128, "position": 0, "product_id": 143, "src": "http://asset.localtestasset.com/image/53faef5b6387e448ad0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅在线支付 - 顺丰)", "options_desc": "颜色:地地道道", "price": 1, "quantity": 1, "updated_at": "2015-04-29T21:18:28.124+08:00", "volume": 0, "weight": 0 } ], "order_id": 320, "serial_number": "01", "ship_no": "", "ship_type": "sf-express", "shipment_supplier": { "code": "shunfeng", "id": 2, "name": "顺丰速递" }, "status": "pending", "updated_at": "2015-04-29T21:18:28.124+08:00" }, { "amount": 16, "auto_received_at": "2015-05-30T03:00:00.000+08:00", "created_at": "2015-04-30T17:25:10.072+08:00", "id": 360, "items": [ { "created_at": "2015-04-30T17:25:10.072+08:00", "id": 388, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 128, "position": 0, "product_id": 143, "src": "http://asset.localtestasset.com/image/53faef5b6387e448ad0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅在线支付 - 顺丰)", "options_desc": "颜色:地地道道", "price": 1, "quantity": 1, "updated_at": "2015-04-30T17:25:10.072+08:00", "volume": 0, "weight": 0 } ], "order_id": 321, "serial_number": "01", "ship_no": "", "ship_type": "sf-express", "shipment_supplier": { "code": "shunfeng", "id": 2, "name": "顺丰速递" }, "status": "pending", "updated_at": "2015-04-30T17:25:10.072+08:00" }, { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } ] }
- 获取指定id范围的Shipment列表
- GET /shipments?ids=360,362
{ "shipments": [ { "amount": 16, "auto_received_at": "2015-05-30T03:00:00.000+08:00", "created_at": "2015-04-30T17:25:10.072+08:00", "id": 360, "items": [ { "created_at": "2015-04-30T17:25:10.072+08:00", "id": 388, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 128, "position": 0, "product_id": 143, "src": "http://asset.localtestasset.com/image/53faef5b6387e448ad0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅在线支付 - 顺丰)", "options_desc": "颜色:地地道道", "price": 1, "quantity": 1, "updated_at": "2015-04-30T17:25:10.072+08:00", "volume": 0, "weight": 0 } ], "order_id": 321, "serial_number": "01", "ship_no": "", "ship_type": "sf-express", "shipment_supplier": { "code": "shunfeng", "id": 2, "name": "顺丰速递" }, "status": "pending", "updated_at": "2015-04-30T17:25:10.072+08:00" }, { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } ] }
- 获取Shipment列表,只显示部分字段
- GET /shipments?fields=id,amount,order_id
{ "shipments": [ { "id": 359, "amount": 16, "order_id": 320 }, { "id": 360, "amount": 16, "order_id": 321 }, { "id": 362, "amount": 0, "order_id": 323 } ] }
- 获取指定
id
之后的Shipment列表 - GET /shipments?since_id=360
{ "shipments": [ { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } ] }
- 获取指定
- 获取指定
order_id
的Shipment列表 - GET /shipments?order_id=323
{ "shipments": [ { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } ] }
- 获取指定
- 获取指定
status
的Shipment列表 - GET /shipments?status=send
{ "shipments": [ { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } ] }
- 获取指定
GET /shipments/count
获取 Shipment 数量
- 获取Shipment数量
- GET /shipments/count
{ "count": 252 }
GET /shipments/#{id}
获取单个 Shipment
- fields
- 以
,
拼接Response显示的字段
- 获取单个Shipment
- GET /shipments/#{id}
{ "shipment": { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } }
PUT /shipments/#{id}
更新 Shipment
- shipment_supplier_id
- Shipment 的 ShipmentSupplier 物流供应商
- custom_supplier_name
- 当Shipment 的 ShipmentSupplier 物流供应商为
其他物流
时,可以通过此参数设置自定义的物流名称(注意:自定义物流系统将无法追中包裹物流配送状态)
- ship_no
- Shipment 的物流配送单号,用于系统和顾客追踪包裹物流配送状态
- dis_type
- Shipment 的发货类型,用于区分不同发货类型 0:普通物流 1:保税仓 2:跨境直邮
- is_send
- 如果传递当前参数,即可同步进行发货操作,不需要再单独调用send接口
- remark
- 给顾客展示的发货留言信息字段,可作为虚拟物品发货的信息记录
- 更新 Shipment 的物流供应商
- PUT /shipments/362
{ "shipment": { "shipment_supplier_id": 4 } }
{ "shipment": { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } }
- 更新 Shipment 的物流配送单号
- PUT /shipments/362
{ "shipment": { "ship_no": "204997145429" } }
{ "shipment": { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "204997145429", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } }
PUT /shipments/#{id}/send
设置 Shipment 发货
- remark
- 给顾客展示的发货留言信息字段,可作为虚拟物品发货的信息记录
- 设置 Shipment 发货
- PUT /shipments/362/send
{ "shipment": { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } }
- 当 Shipment 的状态不允许发货时,会返回错误提示
- PUT /shipments/360
{ "code": 422, "errors": [ "运单状态不支持配送" ] }
PUT /shipments/#{id}/split
设置 Shipment 拆单
- ship_type
- Shipment 的配送物流类型,取值(0,1,2,3,4,5) 0-快递 1-顺丰 2-EMS 3-平邮 4-商家自送 5-自提
- 设置 Shipment 发货
- PUT /shipments/362/split
{ "ship_type": 0 }
{ "shipment": { "amount": 0, "auto_received_at": "2015-06-10T03:00:00.000+08:00", "created_at": "2015-05-10T20:43:07.241+08:00", "id": 362, "items": [ { "created_at": "2015-05-10T20:43:07.241+08:00", "id": 390, "image": { "alt": "", "created_at": "2014-08-23T22:19:11.207+08:00", "file_name": "1.jpg", "id": 148, "position": 0, "product_id": 147, "src": "http://asset.localtestasset.com/image/53faefbc6387e4491d0000031.jpg1408803551", "updated_at": "2014-08-23T22:19:11.207+08:00", "variant_ids": [ ] }, "name": "TEST (仅货到付款 - 自提)", "options_desc": "颜色:123", "price": 1, "quantity": 1, "updated_at": "2015-05-10T20:43:07.241+08:00", "volume": 0, "weight": 0 } ], "order_id": 323, "serial_number": "01", "ship_no": "123", "ship_type": "customer-fetch", "shipment_supplier": { "code": "ems", "id": 4, "name": "EMS" }, "status": "send", "updated_at": "2015-05-12T14:48:09.598+08:00" } }
- 当 Shipment 的状态不允许拆单时,会返回错误提示
- PUT /shipments/360
{ "code": 422, "errors": [ "运单状态不支持配送" ] }
以上内容仍未解决您的问题?
联系在线客服