3.1.3 Create / Modify Shipments (Python)

Create Shipment

Sample source code to create shipment
#!/usr/bin/python import time import json import requests def processShipments(url, data): res = requests.post(url, data=data, headers={'Content-Type': 'application/json'}) responseContent = res.content j = json.loads(responseContent) return j sandbox_url = "https://sandbox.unixus.com.my/api/EzLabel/Client/Shipments.svc/Json/ProcessShipments" production_url = "https://api.unixus.com.my/EzLabel/Client/Shipments.svc/Json/ProcessShipments" request_data = { "_shipmentsParameter" : { "ActionType" : "0", "ShipmentsCredentials" : { "CultureType" : "0", "Password" : "password", "UserName" : "username" }, "ShipperInfo" : { "ShipperName" : "Unixus Solutions Sdn. Bhd.", "ContactPerson" : "IT Department", "Address1" : "46-02 JALAN TUN ABDUL RAZAK,", "Address2" : "SUSUR 1,", "Address3" : "", "PostCode" : "80000", "City" : "JOHOR BHARU", "State" : "JOHOR", "CountryCode" : "MY", "StationCode" : "", "Phone1" : "607-2222668", "Phone2" : "", "MobilePhone" : "", "Fax" : "", "Email" : "[email protected]", "Url" : "" }, "ConsigneeInfo" : { "ConsigneeName" : "LWE (AU) Ltd.", "ContactPerson" : "Mr. Ng", "IdentityNo" : "0123abcd", "Address1" : "Test Address 1", "Address2" : "Test Address 2", "Address3" : "", "PostCode" : "70000", "City" : "JOHOR BHARU", "State" : "JOHOR", "CountryCode" : "MY", "StationCode" : "", "Phone1" : "60-7-2222668", "Phone2" : "", "MobilePhone" : "", "Fax" : "", "Email" : "[email protected]", "Url" : "http://www.lwe.com.hk" }, "CustomerCode" : "300001", "ProfitCentreCode" : "", "ShipmentDate" : "/Date(1510641435000+0800)/", "HawbNo" : "", "ReferenceNo" : "123456", "ReferenceAgent" : "", "TOSMode" : "MY-E-EXPRESS", "PackageType" : "0", "NatureOfGoods" : "SHOES", "NoOfPieces" : "1", "WeightType": 0, "CurrencyCode": "AUD", "Remarks" : "The shipment easy to broke, please becareful.", "CODValue" : "", "CODCurrency" : "", "InsuranceValue" : "5", "InsuranceCurrency" : "MYR", "WeightInfo" : [ { "PackageReference" : "PKG01", "PackageHeight" : "1", "PackageLength" : "1", "PackageWidth" : "1", "ActualWeight" : "5" } ], "ItemInfo" : [ { "ItemReference" : "LADIES SHOES", "NoOfUnit" : "3", "ItemValue" : "15" } ], "TagsInfo" : [ { "TagCode" : "TAG1", "TagValue" : "ANY EXTRA INFORMATION" } ], "Submitted_Date" : "/Date(1510641435000+0800)/" } } resData = processShipments(sandbox_url, json.dumps(request_data)) print(resData)

Modify Shipment

Sample source code for modify shipment
#!/usr/bin/python import time import json import requests def processShipments(url, data): res = requests.post(url, data=data, headers={'Content-Type': 'application/json'}) responseContent = res.content j = json.loads(responseContent) return j sandbox_url = "https://sandbox.unixus.com.my/api/EzLabel/Client/Shipments.svc/Json/ProcessShipments" production_url = "https://api.unixus.com.my/EzLabel/Client/Shipments.svc/Json/ProcessShipments" request_data = { "_shipmentsParameter" : { "ActionType" : "1", "ShipmentsCredentials" : { "CultureType" : "0", "Password" : "password", "UserName" : "username" }, "ShipperInfo" : { "ShipperName" : "Unixus Solutions Sdn. Bhd.", "ContactPerson" : "IT Department", "Address1" : "46-02 JALAN TUN ABDUL RAZAK,", "Address2" : "SUSUR 1,", "Address3" : "", "PostCode" : "80000", "City" : "JOHOR BHARU", "State" : "JOHOR", "CountryCode" : "MY", "StationCode" : "", "Phone1" : "607-2222668", "Phone2" : "", "MobilePhone" : "", "Fax" : "", "Email" : "[email protected]", "Url" : "" }, "ConsigneeInfo" : { "ConsigneeName" : "LWE (AU) Ltd.", "ContactPerson" : "Mr. Ng", "IdentityNo" : "0123abcd", "Address1" : "Test Address 1", "Address2" : "Test Address 2", "Address3" : "", "PostCode" : "70000", "City" : "JOHOR BHARU", "State" : "JOHOR", "CountryCode" : "MY", "StationCode" : "", "Phone1" : "60-7-2222668", "Phone2" : "", "MobilePhone" : "", "Fax" : "", "Email" : "[email protected]", "Url" : "http://www.lwe.com.hk" }, "CustomerCode" : "300001", "ProfitCentreCode" : "", "ShipmentDate" : "/Date(1510641435000+0800)/", "HawbNo" : "344010500000151", "ReferenceNo" : "123456", "ReferenceAgent" : "", "TOSMode" : "MY-E-EXPRESS", "PackageType" : "0", "NatureOfGoods" : "SHOES", "NoOfPieces" : "1", "WeightType": 0, "CurrencyCode": "AUD", "Remarks" : "The shipment easy to broke, please becareful.", "CODValue" : "", "CODCurrency" : "", "InsuranceValue" : "5", "InsuranceCurrency" : "MYR", "WeightInfo" : [ { "PackageReference" : "PKG01", "PackageHeight" : "1", "PackageLength" : "1", "PackageWidth" : "1", "ActualWeight" : "5" } ], "ItemInfo" : [ { "ItemReference" : "LADIES SHOES", "NoOfUnit" : "3", "ItemValue" : "15" } ], "TagsInfo" : [ { "TagCode" : "TAG1", "TagValue" : "ANY EXTRA INFORMATION" } ], "Submitted_Date" : "/Date(1510641435000+0800)/" } } resData = processShipments(sandbox_url, json.dumps(request_data)) print(resData)
Copyright © 2018 Unixus Solutions Sdn. Bhd. All rights reserved.