3.1 创建货件

描述

本节将向您展示如何使用此API创建货件.


请求

数据结构

CreateShipments
Field Type Mandatory Remarks
Shipments CreateShipmentDetails[] Yes 参考 CreateShipmentDetails
CreateShipmentDetails
Field Type Mandatory Remarks
Shipper PersonInfo Yes 参考 PersonInfo
Consignee PersonInfo Yes 参考 PersonInfo
Items ItemInfo[] Yes 参考 ItemInfo
Packages PackageInfo[] Yes 参考 Packages
ShipmentDate DateTime Yes Example: 2018-07-01T00:00:00+08:00
TOSMode String Yes 参考 TOS Mode
ReferenceNo String No
ReferenceSource String No
PackageType Enum Yes 参考 PackageType
WeightType Enum Yes 参考 WeightType
CurrencyCode String Yes
Remarks String No
PersonInfo
Field Type Mandatory Description
Name String No
ContactPerson String Yes
IdentityNo String No
Address1 String Yes
Address2 String No
Address3 String No
Postcode String Yes
City String Yes
State String Yes
CountryCode String Yes
StationCode String No
Phone1 String Yes
Phone2 String No
MobilePhone String No
Fax String No
Email String No
Url String No
ItemInfo
Field Type Mandatory Description
Description String Yes
Quantity Integer Yes
UnitValue Numeric Yes
HSCode String No
SKU String No
Url String No
PackageInfo
Field Type Mandatory Description
PackageReference String Yes
Length Numeric Yes Length in CM
Width Numeric Yes Width in CM
Height Numeric Yes Height in CM
ActualWeight Numeric Yes Actual weight in KG
TOS Mode

TOS代表服务类型。装运信息中TOS模式的值基于收货人国家/地区代码。以下代码是您如何分配TOSMode值的示例。如果您遇到无效TOS错误,请联系我们的客户支持.

public string GetTOSMode(string consigneeCountry) { switch (consigneeCountry) { case "MY": return "MY-E-EXPRESS"; case "TH": return "TH-E-EXPRESS"; case "HK": return "HK-E-EXPRESS"; case "SG": return "SG-E-EXPRESS"; case "ID": return "ID-E-EXPRESS"; case "CN": return "CN-E-EXPRESS"; default: // error } }
PackageType and WeightType
// If in doubt, choose SPX public enum PackageType { DOX, SPX, SPX_L, SPX_P, SPX_S } public enum WeightType { KG, LBS }

Sample:

POST /{api_version}/Create
Content-Type: application/json
Accept-Language: en
Authorization: Bearer {access_token}
{ "Shipments": [ { "Shipper": { "Name": " DEMO ACCOUNT", "ContactPerson": "DEMO ACCOUNT", "Address1": "Block C, 3A01 & 3A02,", "Address2": "Level 3A, Kelana Square,", "Address3": "No.17, Jalan SS7/26", "Postcode": "47301", "City": "Petaling Jaya", "State": "Selangor", "CountryCode": "MY", "Phone1": "+60378038830" }, "Consignee": { "ContactPerson": "LWE (AU) Ltd.", "Address1": "Test Address 1", "Address2": "Test Address 2", "Postcode": "70000", "City": "JOHOR BHARU", "State": "SELANGOR", "CountryCode": "MY", "Phone1": "03-8888888" }, "Items": [ { "Description": "item1", "Quantity": 10, "UnitValue": 20.0, "HSCode": "30", "SKU": "40", "Url": "50" } ], "Packages": [ { "PackageReference": "pkg1", "Length": 10.0, "Width": 20.0, "Height": 30.0, "ActualWeight": 40.0 } ], "PackageType": "SPX", "WeightType": "KG", "ShipmentDate": "2018-07-01T00:00:00+08:00", "TOSMode": "MY-E-EXPRESS", "CurrencyCode": "MYR" } ] }

响应

样品

{ "Summary": { "Total": 1, "Success": 1, "Failed": 0 }, "ShipmentsResponse": [ { "IsSuccess": true, "ShipmentDetails": { "Shipper": { "Name": " DEMO ACCOUNT", "ContactPerson": "DEMO ACCOUNT", "Address1": "Block C, 3A01 & 3A02,", "Address2": "Level 3A, Kelana Square,", "Address3": "No.17, Jalan SS7/26", "Postcode": "47301", "City": "Petaling Jaya", "State": "Selangor", "CountryCode": "MY", "Phone1": "+60378038830" }, "Consignee": { "ContactPerson": "LWE (AU) Ltd.", "Address1": "Test Address 1", "Address2": "Test Address 2", "Postcode": "70000", "City": "JOHOR BHARU", "State": "SELANGOR", "CountryCode": "MY", "Phone1": "03-8888888" }, "Items": [ { "Description": "item1", "Quantity": 10, "UnitValue": 20.0, "HSCode": "30", "SKU": "40", "Url": "50" } ], "Packages": [ { "PackageReference": "pkg1", "Length": 10.0, "Width": 20.0, "Height": 30.0, "ActualWeight": 40.0 } ], "ShipmentsReference": [ { "CarrierName": "POS-LAJU", "ReferenceNo": "458040010409726" } ], "HawbNo": "458040010409726", "TOSMode": "MY-E-EXPRESS", "CurrencyCode": "MYR", "PackageType": "SPX", "WeightType": "KG", "ShipmentDate": "2018-07-01T00:00:00+08:00" } } ] }
Copyright © 2018 Unixus Solutions Sdn. Bhd. All rights reserved.