6-2. 批量创建共享订单

url

http://test.birdsystem.com/client/Consignment/Post-Pending-Consignment-With-Products-Json

method

post

body

[
    {
        "contact": "Norman Drury",
        "business_name": null,
        "address_line1": "3, Northam Close",
        "address_line2": "Marshside",
        "address_line3": null,
        "city": "Southport",
        "county": "Merseyside",
        "post_code": "PR9 9GA",
        "country_iso": "GB",
        "telephone": "01704 226830",
        "email": null,
        "delivery_service_id": "2662",
        "sales_reference": "2",
        "sales_order_id": "110222319566-0",
        "special_instruction": null,
        "products":[
           {"client_sku":"983#983-96678#D","quantity":1},
            {"id":"983#96680#D","quantity":1}
        ]
    }
]

返回

{
  "success": true,
  "data": [
    {
      "id": 1612120020000011,
      "company_id": 2,
      "client_id": 1,
      "consignment_product_quantity": 9,
      "consignment_product_reference": "1,2",
      "delivery_service_id": 1471,
      "delivery_service_id_internal": 1471,
      "delivery_package_size_id": 432,
      "delivery_package_size_id_internal": 432,
      "total_price": "0.00",
      "total_cost": "0.00",
      "...": "...",
	  "contact": "Norman Drury",
      "business_name": null,
      "address_line1": "3, Northam Close",
      "address_line2": "Marshside",
      "address_line3": null,
      "city": "Southport",
      "county": "Merseyside",
      "post_code": "PR9 9GA",
      "country_iso": "GB",
      "telephone": "01704 226830",
      "email": null,
      "sales_reference": "2"
    }
  ]
}

参数

is_urgent

是否是紧急订单


TINYINT(1)

delivery_service_id

delivery_service_name

邮递服务ID或者邮递服务名称二选 一

必填

INT(4)/VARCHAR(50)

return_consignment_action-id退货服务ID退货订单时必填INT(4)

sales_reference

销售跟踪号


VARCHAR(50)

sales_order_id

eBay或Amazon订单ID

(注:对eBay订单,如果客户有多个eBay账户,那么请把eBay卖家ID信息

也填在这里,可以按以下格式: “SellerUserID : OrderID” )


VARCHAR(50)

delivery_reference

邮递跟踪号(注:此字段能否设置成功还要看邮递服务设置,如果传了这个字段没有设置成功,请咨询客服)


VARCHAR(50)

custom_identity_reference


自定义惟一标识

(注: 如果填写了,会进行检测,同一种类型同一站点下的订单,6个月内不能有重复的标识)

重复的话会返回: {"success":false,"message":"Duplicate consignment identity reference [....]"}


VARCHAR(50)

contact

联系人

必填

VARCHAR(100)

business_name

公司


VARCHAR(255)

address_line1

地址行1


VARCHAR(100)

address_line2

地址行2


VARCHAR(100)

address_line3

地址行3


VARCHAR(100)

city

城市


VARCHAR(50)

county

省/郡


VARCHAR(50)

post_code

邮编


VARCHAR(10)

country_iso

国家

必填

CHAR(2)

telephone

电话


VARCHAR(50)

email

电子邮件


VARCHAR(255)

special_instruction:

备注1


VARCHAR(255)

neighbour_instruction:

备注2


VARCHAR(255)

type

订单类型
['LOCAL','RETURN]  本地订单就用LOCAL, 退货订单就用RETURN

products

产品

必填

包含 

id /client_sku/reference 和quantity的json对象例如:

[{"client_sku":"983#983-96678#D","quantity":1},
{"id":"983#96680#D","quantity":1}

]

reference是基于客户对批量订单产品字段的设置, 自动识别为ID或者SKU.

对于代理专线订单, 需要传如下格式的产品:

[
 {"product_name":”IP-XX3355”,"quantity":5,"weight":5,"price":5},

]

涉及到父子账号,使用父账号API_key下单时的格式如下:

{"client_sku":"ShareFromClientId#client_sku#D#ShareToClientId","quantity":1}, {"id":"ShareFromClientId#ProductId#D#ShareToClientId","quantity":1}

这个D后面的是可选的 父账号下单的时候就填共享给哪个子账号的id

例如:983是3887与47的父账号,3887共享产品1789375给47,使用父账号下单格式:

{"client_sku":"3887#3887-675197#D#47","quantity":1}, {"id":"3887#1789375#D#47","quantity":1}

parcel_pieces多包裹信息可选(如果仅一个包裹时可不用填)

数据结构如下:

[

{"weight":500, "length":25, "width":20, "depth":15, "description":"table"},

{"weight":400, "length":22, "width":18, "depth":13, "description":"chair"},

]

备注:重量为克(g),长度为毫米(mm)


此种方式需在POST前确保所有数据都正确,数据不正确的,将报错 不能创建订单。 附上相关用例文件: 创建订单用例.postman_collection.json