[This is preliminary documentation and is subject to change.]
This walkthrough is for creating a courier (Purolator, Canada Post, PuroPost) order with one
AddOrder(OrderRequestV3) request;
if you are creating an LTL order then see the LTL walkthrough.
This walkthrough assumes that Purolator is handling customs; if you are using a different customs broker then ignore code related to Item data.
Create and populate an OrderRequestV3 object.
CredentialInfo credentials = new CredentialInfo { UserName = "User", Password = "****", ClientID = "0000000" };
OrderRequestV3 orderRequest = new OrderRequestV3
{
Credentials = credentials,
ShipToAddress = new Address
{
Name = "Test Customer Name",
Add1 = "560 Kings Road",
City = "Sydney",
StateProv = "NS",
PostalCode = "B1S1B8",
Country = "CA"
},
OrderNumber = "Order-13544364-1",
ShipMethod = "GROUND",
LabelType = "ZPLIMAGES",
ShipDate = DateTime.Today,
Packages = new List<RequestPackageV3>
{
new RequestPackageV3 { PackageID = "PKG-13544364-01", WeightUOM = "LB", Weight = 10.0m, }
}.ToArray(),
Items = new List<RequestItemV3>
{
new RequestItemV3
{
SKU = "x35135",
CustomsDesc = "Documents",
Quantity = 2,
TotalValue = 10,
Currency = "CAD",
CountryOfOrigin = "United States",
}
}.ToArray()
};
Dim credentials As CredentialInfo = New CredentialInfo With {.UserName = "User", .Password = "****", .ClientID = "0000000"}
Dim orderRequest As New OrderRequestV3() With {
.Credentials = credentials,
.ShipToAddress = New Address() With {
.Name = "Test Customer Name",
.Add1 = "560 Kings Road",
.City = "Sydney",
.StateProv = "NS",
.PostalCode = "B1S1B8",
.Country = "CA"
},
.OrderNumber = "Order-13544364-1",
.ShipMethod = "GROUND",
.LabelType = "ZPLIMAGES",
.ShipDate = DateTime.Today,
.Packages = New List(Of RequestPackageV3)() From {
New RequestPackageV3() With { .PackageID = "PKG-13544364-01", .WeightUOM = "LB", .Weight = 10.0 }
}.ToArray(),
.Items = New List(Of RequestItemV3)() From {
New RequestItemV3() With {
.SKU = "x35135",
.CustomsDesc = "Documents",
.Quantity = 2,
.TotalValue = 10,
.Currency = "CAD",
.CountryOfOrigin = "United States"
}
}.ToArray()
}
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
Submit request.
ShippingServicesSoapClient client = new ShippingServicesSoapClient("PurolatorWebService");
OrderResponse orderResponse = client.AddOrder(orderRequest);
if (orderResponse.Status == (int)SeverityEnum.Error)
{
foreach (ResponseMessage message in orderResponse.Messages)
{
Console.Write(message.Message);
}
}
return orderResponse;
Dim client As ShippingServicesSoapClient = New ShippingServicesSoapClient("PurolatorWebService")
Dim orderResponse As OrderResponse = client.AddOrder(orderRequest)
If orderResponse.Status = CInt(SeverityEnum.FatalError) Then
For Each message As ResponseMessage In orderResponse.Messages
Console.Write(message.Message)
Next
End If
Return orderResponse
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
Print and apply the label for each package. See ZPL page
for more information.
foreach (ResponsePackage package in orderResponse.Packages)
{
RawDataPrinterHelper.SendStringToPrinter(zplPrinterName, package.ZPLCode);
}
For Each package As ResponsePackage In orderResponse.Packages
RawDataPrinterHelper.SendStringToPrinter(zplPrinterName, package.ZPLCode)
Next
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
When all orders have the correct labels attached and are ready to ship, create a Closeout to complete processing. See the
Closeout page for more information.