Overview
The Pacejet API supports a one-call freight quoting use-case using the Rates endpoint to return all services, prices, costs, transit-times for all available carriers with one, fast request. The one-call Rates resource is popular for ecommerce applications to display additional services and rates in shopping carts as well as for ERP systems where a pop-up shipping rate calculator is desired on sales orders or other transactions.
When the POST Rates resource is used, the Pacejet platform returns a response including a full range of carrier services, prices, costs, transit-times, and other information. For this use-case, applications control the user experience and could, for example, model the user experience after the Pacejet Rate & Ship screen.
The request content for the Rates resource closely mirrors the content used for the Shipments and Quotes resource, including options for auto packing, special services, and other details. However, two required fields that are unique to the Rates resource include the LicenseID and the UPSLicenseID field. The additional license keys are provided with your Pacejet location and are required to support additional controls around rating features.
{
"Location": "DemoAPI",
"LicenseID": "955726f5-207e-562f-c19e-85d9093dc6cf",
"UpsLicenseID": "9db7d89f-27e7-f67e-d50f-45645a3a52d4",
"Origin": {}
…
} Using Rates with Auto Packing By Transaction
One of the most common use-cases implemented with the Rates endpoint is freight quotes using auto packing enabled to estimate packaging for more accurate shipping prices. Pacejet can enable auto packing for your account by installing a plug-in which calculates packaging estimates based on customizable logic. Standard data conventions are used to control how packages estimates are calculated and to control when auto packing is performed on a transaction by transaction basis.
To try out auto packing with the Rates endpoint, first request that an auto pack plug-in is activated for your account. Pacejet will use an administrative process to install a standard plug-in for testing, you may choose to request customizations to this logic or use the standard behavior.
Once an auto packing plug-in is enabled for your account, Rates requests can include the AutoPackShipment flag at the shipment level with a setting of TRUE or FALSE to trigger auto packing behavior on a transaction by transaction basis. Your Rates requests should always include the AutoPack flag set to true (mix this item with other items via auto packing) or false (pack this item in its own container via auto packing) for all products to allow auto packing to be used. If the AutoPackShipment flag is FALSE then no auto packing will be triggered and containerization is controlled by the request contents information.
{
// SAMPLE: Items and Quantity with Auto Pack By Transaction
"Location": "DemoAPI",
"LicenseID": "955726f5-207e-562f-c19e-85d9093dc6cf",
"UpsLicenseID": "9db7d89f-27e7-f67e-d50f-45645a3a52d4",
"Origin": {
"CompanyName": "ShipItFaster.com",
"Address1": "709 E. 44th",
"City": "Lubbock",
"StateOrProvinceCode": "TX",
"PostalCode": "79404",
"CountryCode": "US",
"ContactName": "Steve Sellers",
"Email": "steve.sellers@shipitfaster.com",
"Phone": "877-722-3538"
},
"Destination": {
"CompanyName": "Buysalot, Inc",
"Address1": "3185 Main Ave",
"City": "Fargo",
"StateOrProvinceCode": "ND",
"PostalCode": "58103",
"CountryCode": "US",
"ContactName": "Bob Buyers",
"Email": "bob.buyers@buysalot.com",
"Phone": "877-722-3538"
},
"CustomFields": [
// Flag to disable autopack for a specific transaction (default is TRUE) {
"name": "AutoPackShipment",
"value": "TRUE"
}
],
"PackageDetailsList": [
{
"Dimensions": {
"Length": "20",
"Width": "12",
"Height": "15",
"Units": "IN"
},
"ProductDetailsList": [
{
"Number": "IPA6",
"Description": "Ipad Air 6",
"Weight": "4",
// True indicator means this item can auto pack with other items
"AutoPack": "true",
"Dimensions": {
"Length": "6",
"Width": "12",
"Height": "1",
"Units": "IN"
},
"packUIRmngItem": "N",
"Quantity": {
"Units": "EA",
"Value": "4"
},
"commodityName": "391721"
},
{
"Number": "MACBK",
"ExternalID": "MAKBK-E",
"Description": "MacBook Air",
"Weight": "6",
// False indicator marks this as a self-pack, ships in its own box
"AutoPack": "false",
"Dimensions": {
"Length": "12",
"Width": "10",
"Height": "4",
"Units": "IN"
},
"packUIRmngItem": "N",
"Quantity": {
"Units": "EA",
"Value": "3"
},
"commodityName": "391721"
},
{
"Number": "IPH6",
"ExternalID": "IPH6-E",
"Description": "iPhone 10",
"Weight": "2",
// True indicator means this item can auto pack with other items
"AutoPack": "true",
"Dimensions": {
"Length": "6",
"Width": "4",
"Height": "1",
"Units": "IN"
},
"packUIRmngItem": "N",
"Quantity": {
"Units": "EA",
"Value": "2"
},
"commodityName": "391721"
}
]
},
{
"Dimensions": {
"Length": "25",
"Width": "10",
"Height": "12",
"Units": "IN"
},
"ProductDetailsList": [
{
"Number": "IPA6",
"ExternalID": "IPA6-E",
"Description": "Ipad Air 6",
"Weight": "4",
// True indicator means this item can auto pack with other items
"AutoPack": "true",
"Dimensions": {
"Length": "6",
"Width": "12",
"Height": "1",
"Units": "IN"
},
"packUIRmngItem": "N",
"Quantity": {
"Units": "EA",
"Value": "3"
},
"commodityName": "391721"
}
]
}
]
}Using the API | Samples | Rates sample page, send in the above request to Rates and review the response results shown below. Note that in this case a serviceRecommendationList section as shown below is returned with lowestCostConsigneeFreight value of 69.84 based on a selection of FedEx Ground for this request. The complete response includes all carriers and services returned, allowing an integration to use any of this information for custom displays or custom calculations.
One way to more easily compare Rates responses and monitor auto packing results is to send the Rates request information in via the Shipments request and use the Rate and Ship page to review results (warning: there is no implied compatibility between the requests for Rates and Shipments; they are entirely different requests and have some differences. Most of the information is the same so this technique can be useful in some scenarios). Sending in the previous Rates request in via Shipments and running an onscreen quote results in the display shown below where the same FedEx Ground selection is shown as the lowest cost option of 69.84.
Look more closely at the Package Information area in the previous example and note that 4 Packages with a total weight of 51 lbs are in the shipment. Click on the contents packaging icon to review items in containers shows that the auto packing logic grouped the iPads and iPhones into one box but left the MacBooks in their own boxes (i.e. self packed) as shown below.
To see the behavior with auto packing disabled, change the AutoPackShipment flag to FALSE in the same request and POST it via Rates. Notice that FedEx Ground is still returned as the lowest cost option but in this case the ConsigneeFreight amount is $55.21 as shown below.
To take a closer look at the behavior, send the same request in via the Shipments endpoint and run a freight quote as shown below. Notice in this case that the Packaging Information section now shows only 2 packages used in this rating request and the same price value of $55.21 is displayed.