Non-Contract Shipping

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

Get Non-Contract Shipments – REST

Summary

Name: Get Non-Contract Shipments
Reason to Call: This call is used to search for links to recently created non-contract shipments for the purpose of recovery or re-print.
Input: Query string parameters: from, to
Output:

links to shipments within the date and time range

Typical Next Call: Get Non-Contract Shipment
Version history: Release notes

Request Details

Request – Structure for Get Non-Contract Shipments

Endpoint

GET https://XX/rs/{mailed by customer}/ncshipment?from=YYYYMMDDHHMM&to=YYYYMMDDHHMM&trackingPIN={tracking-pin}

Replace... With...

XX (Development)

ct.soa-gw.canadapost.ca

XX (Production)

soa-gw.canadapost.ca

{mailed by customer}

your customer number

query string parameters

From and to dates
If the "to" parameter is not provided, it will default to the current date and time.
All dates and times are interpreted as being in the Eastern time zone.

Tracking PIN
To retrieve the links for a specific shipment, provide the tracking PIN. From and to date parameters are not required if the tracking PIN is provided.

HTTP Headers

HTTP Header Variable

Value

Accept

application/vnd.cpc.ncshipment-v4+xml (Note: */* in place of the header value will return an error)

Content-Type

application/vnd.cpc.ncshipment-v4+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 Non-Contract Shipments service does not require any XML input data, but the query string defines the type of search: use a date range or a tracking PIN (for a specific shipment). Note: In the sandbox (development) environment, the same tracking PIN is always returned (123456789012), so this query would not return representative results in that environment.

Response Details

Response – Elements

Get Non-Contract Shipments – Response Elements
Element Name Type Description
non-contract-shipments Complex This is the top level XML element of the response structure.
link Complex

The top level shipments structure contains a number of link elements. For a description of link attributes, see Provided endpoints.

The href attribute can be used as an endpoint to the Get Non-Contract Shipment service for the shipment. See Get Non-Contract Shipment for information on how to invoke that service.

Response – XML Diagram

Get Non-Contract Shipments – Structure of the XML Response

Get Non-Contract Shipments – Structure of the XML Response

Response – Possible Error Responses

If no shipments are found, the XML response will be 200 and there will be an empty "non-contract-shipments" structure.

Parameter error messages for HTTP response 400 are shown below. (For more information, see HTTP status codes.)

Code Message
9105 A required query parameter was not provided in the request.
9116 The "from" date cannot be a later date than the "to" date.
9196 Only one of from (date) and tracking PIN must be provided.

Examples

Sample REST XML Request – Get Non-Contract Shipments

There is no XML related to this REST request. Use the link provided by a prior request or see the soapUI project files for request examples.

Sample REST XML Response – Get Non-Contract Shipments

<non-contract-shipments>
<link rel="shipment" href="https://ct.soa-gw.canadapost.ca/rs/0007023211/ncshipment/406951321983787352" media-type="application/vnd.cpc.ncshipment-v4+xml"></link>
</non-contract-shipments>