Contract Shipping
Get Shipment Price – REST
Summary
Name: | Get Shipment Price |
---|---|
Reason to Call: | To retrieve shipment price information from a previously created shipment. |
Input: | Invoke the link returned from Create Shipment or Get Shipment where rel= “price” |
Output: | The price details in an XML format, with options and taxes being separately described. |
Error Example: | The Deposit Date must be greater than or equal to today's date. |
Typical Prior Call: | Create Shipment or Get Shipment |
Typical Next Call: | Create Shipment (to continue creating shipments) |
Optional Next Call: | Get Artifact or Get Shipment Details (if those services have not already been called) |
Version history: | Release notes |
Request Details
Request – Structure for Get Shipment Price
Endpoint
Invoke the link returned from a prior call where rel= “price” (see Provided endpoints)
HTTP Headers
HTTP Header Variable |
Value |
---|---|
Accept |
application/vnd.cpc.shipment-v8+xml (Note: */* in place of the header value will return an error) |
Authorization |
Basic {Base64 encoding of userid:password} |
Accept-language |
en-CA or fr-CA |
Body
None
Request – Elements
The Get Shipment Price service does not require any input XML data.
Response Details
Response – Elements
The following table describes the top level view of the XML data in the response.
Get Shipment Price – Detailed View of Response Elements | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Element Name | Type | Description | ||||||||||||||||||||||||||||||||
shipment-price |
Complex |
This is the top level XML structure for the response. |
||||||||||||||||||||||||||||||||
service-code |
Simple |
(Character string – up to 32 characters) Must be a valid code representing the Canada Post delivery service used for shipping the item. The most frequently used codes are listed below.
(Note: These delivery services and their codes can be discovered by calling the Get Rates or Discover Services web services described in Rating) Contained within shipment-price. This identifies the delivery service-code used for delivery of the shipment. |
||||||||||||||||||||||||||||||||
base-amount |
Simple |
(Numeric field of pattern 6.2 i.e. 999999.99) Contained within shipment-price. This is the base amount cost for shipping in $CAD. |
||||||||||||||||||||||||||||||||
priced-options |
Complex |
Contained within shipment-price. This structure contains the list of options applied to this shipment and the associated price impact. This will be absent if there are no options applied to the price of this shipment. |
||||||||||||||||||||||||||||||||
priced-option |
Complex |
Contained within priced-options. May occur 1 … N times. Each occurrence is a structure that represents a shipping option that applies to the shipment, and which may affect the price of the shipment. |
||||||||||||||||||||||||||||||||
option-code |
Simple |
(Character String – up to10 characters) Contained within option. This is the option code for an option applied to this shipment. Option code examples are as follows COD – Collect on delivery. |
||||||||||||||||||||||||||||||||
option-price |
Simple |
(Numeric field of pattern 6.2 i.e. 999999.99) Contained within option. This is the total component of the price that is attributable to the option. Units are $CAD. |
||||||||||||||||||||||||||||||||
adjustments |
Complex |
Contained within price. This structure contains the list of adjustments applied to this shipment and the associated price impact. This will be absent if there are no adjustments applied to the price of this shipment. |
||||||||||||||||||||||||||||||||
adjustment |
Complex |
Contained within adjustments. May occur 1 … N times. This structure represents a shipping adjustment that applies to the shipment, and which may affect the price of the shipment. |
||||||||||||||||||||||||||||||||
adjustment-code |
Simple |
The code indicating which adjustment is applied to this shipment:
|
||||||||||||||||||||||||||||||||
adjustment-amount |
(Numeric field of pattern 6.2 e.g. 999999.99) Contained within option. This is the total cost attributable to the adjustment. |
|||||||||||||||||||||||||||||||||
pre-tax-amount |
Simple |
(Numeric field of pattern 6.2 e.g. 999999.99) Contained within shipment-price. This is the pre-tax total amount of the shipment cost. |
||||||||||||||||||||||||||||||||
gst-amount |
Simple |
(Numeric field of pattern 6.2 e.g. 999999.99) Contained within shipment-price. This is the amount of the GST added to the base cost. |
||||||||||||||||||||||||||||||||
pst-amount |
Simple |
(Numeric field of pattern 6.2 e.g. 999999.99) Contained within shipment-price. This is the amount of the PST added to the base cost. |
||||||||||||||||||||||||||||||||
hst-amount |
Simple |
(Numeric field of pattern 6.2 e.g. 999999.99) Contained within shipment-price. This is the amount of the HST added to the base cost. |
||||||||||||||||||||||||||||||||
due-amount |
Simple |
(Numeric field of pattern 6.2 e.g. 999999.99) Contained within shipment-price. This is the total amount due for the shipment. |
||||||||||||||||||||||||||||||||
service-standard |
Complex |
Contained within shipment-price. This structure represents the service standard to which this shipment will be delivered. |
||||||||||||||||||||||||||||||||
am-delivery |
Simple |
{true, false} Contained within service-standard. This indicates whether morning delivery is part of the service standard. |
||||||||||||||||||||||||||||||||
guaranteed-delivery |
Simple |
{true, false} Contained within service-standard. This indicates whether guaranteed delivery is part of the service standard. |
||||||||||||||||||||||||||||||||
expected-transmit-time |
Simple |
(Numeric 2-digit - e.g. pattern 99) Contained within service-standard. This indicates the number of days the package is expected to be in the mail stream from induction to delivery. *Should be “expected-transit-time” due to a typo, it will be fixed in the next version |
||||||||||||||||||||||||||||||||
expected-delivery-date |
Simple |
(YYYY-MM-DD date format) Contained within service-standard. This indicates the estimated delivery date based from the creation date of the shipment or the expected mailing date provided in the “create” request if greater. |
||||||||||||||||||||||||||||||||
rated-weight |
Simple |
This indicates the actual weight or volumetric equivalent used to determine the base price, within the prescribed weight and size limits of the specific product, on the greater of actual weight or volumetric equivalent of actual weight. |
Response – XML Diagram
Response – Possible Error Response
No errors are expected for invocation of this link, but you will receive a 404 error if you invoke Get Shipment Price more than 90 days after the link was provided.
For more information, see HTTP status codes.
Examples
Sample REST XML Request – Get Shipment Price
GET https://XX/rs/1234567/1234567/shipment/123456789012345678 id}/price
Accept:application/vnd.cpc.shipment-v8+xml
Authorization:Basic s7HD7gwsennesc==
Note: the HTTP endpoint link and “Accept” value should not be hardcoded. Rather, these values are provided as outputs from the Create Shipment and Get Shipment services.
Sample REST XML Response – Get Shipment Price
<shipment-price>
<service-code>DOM.EP</service-code>
<base-amount>9.19</base-amount>
<priced-options>
<priced-option>
<option-code>DC</option-code>
<option-price>0</option-price>
</priced-option>
<priced-option>
<option-code>UP</option-code>
<option-price>7.50</option-price>
</priced-option>
</priced-options>
<adjustments>
<adjustment>
<adjustment-code>AUTDISC</adjustment-code>
<adjustment-amount>0.00</adjustment-amount>
</adjustment>
<adjustment>
<adjustment-code>FUELSC</adjustment-code>
<adjustment-amount>0.90</adjustment-amount>
</adjustment>
</adjustments>
<pre-tax-amount>17.59</pre-tax-amount>
<gst-amount>0.00</gst-amount>
<pst-amount>0</pst-amount>
<hst-amount>2.29</hst-amount>
<due-amount>19.88</due-amount>
<service-standard>
<am-delivery>false</am-delivery>
<guaranteed-delivery>true</guaranteed-delivery>
<expected-transmit-time>2</expected-transmit-time>
<expected-delivery-date>2011-10-07</expected-delivery-date>
</service-standard>
<rated-weight>10.000</rated-weight>
</shipment-price>