Contract Shipping

Code Samples for Contract Shipping: Java (.zip) | PHP (.zip) | C# (.zip)

Get Shipment – REST

Summary

Name: Get Shipment
Reason to Call: To retrieve the links and tracking PIN related to a previously created shipment.
Input: Invoke the link returned from a prior call.
Output: The shipment tracking PIN, and links to the shipment artifacts (labels). The shipment status is also provided. Note: The output of the Get Shipment service is identical to that of the Create Shipment service.
Error Examples: 404 - Not Found
Typical Prior Call: Create Shipment, Get Shipments
Typical Next Call: Get Artifact, Get Shipment Price, Get Shipment Details
Version history: Release notes
Get Shipment – Summary of Service

Get Shipment – Summary of Service

Request Details

Request – Structure for Get Shipment

Endpoint

Invoke the link from one of these prior calls:

Create shipment where rel="self"

Get Shipments where rel="shipment"

(see Provided endpoints)

HTTP Headers

HTTP Header Variable

Value

Accept

from media-type in original link (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 service does not require any input XML data.

Response Details

Response – Elements

The Get Shipment service response is identical to the response of the Create Shipment service and would also include:

  • The rel=”refund” link if the shipment has been transmitted and a refund has not already been requested.
  • The rel=”price” link if provide-pricing-info was set to true in the Create Shipment request.
  • The rel=”receipt” link if provide-receipt-info was set to true in the Create Shipment request.

Refer to Response – Data Element Details for the details of the response.

Response – XML Diagram

Get Shipment – Structure of XML Response
Get Shipment – Structure of XML Response

Response – Possible Error Responses

No errors are expected for invocation of this link, but you will receive a 404 error if you invoke Get Shipment more than 90 days after the link was provided.

See HTTP status codes for more information

Examples

Sample REST XML Request – Get Shipment

GET https://XX/rs/12341234/123456789/shipment/123456789012345678
Accept:application/vnd.cpc.shipment-v8+xml
Authorization:Basic s7HD7gwsennesc==

Sample REST XML Response – Get Shipment

<shipment-info>

<shipment-id>347881315405043891</shipment-id>
<shipment-status>created</shipment-status>
<tracking-pin>123456789012</tracking-pin>
<po-number>P123456789</po-number>
<links>
<link rel="self" href="https://XX/rs/111111111/2222222222/shipment/347881315405043891" media-type="application/vnd.cpc.shipment-v8+xml"></link>
<link rel="details" href="https://XX/rs/111111111/2222222222/shipment/347881315405043891/details" media-type="application/vnd.cpc.shipment-v8+xml"></link>
<link rel="price" href="https://XX/rs/111111111/2222222222/shipment/347881315405043891/price" media-type="application/vnd.cpc.shipment-v8+xml"></link>
<link rel="receipt" href="https://XX/rs/111111111/2222222222/shipment/347881315405043891/receipt" media-type="application/vnd.cpc.shipment-v8+xml"></link>
<link rel="label" href="https://XX/rs/artifact/11111111/5555555/0" media-type="application/pdf" index="0"></link>
</links>
</shipment-info>