Non-Contract Shipping

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

Get Non-Contract Shipment Public Key Info – REST

Summary

Name: Get Non-Contract Shipment Public Key Info
Reason to Call: To retrieve the details on the public key including expiry date, QR code, public URL (un-authenticated URL)
Input: REST: Invoke the link returned from a prior call.
SOAP: Invoke the operation to get the public key info.
Output:

The public key including expiry date, QR code, public URL (un-authenticated URL)

Error Example: 404 - Not Found
Typical Prior Call: Create Non-Contract Shipment
Get Non-Contract Shipment
Typical Next Call: N/A
Version history: Release notes

Request Details

Request – Structure for Get Non-Contract Shipment Public Key Info

Endpoint

GET https://XX/rs/{mailed_by}/ncshipment/{shipment id}/qrCode

Replace...

With...

XX (Development)

ct.soa-gw.canadapost.ca

XX (Production)

soa-gw.canadapost.ca

{mailed by customer}

your customer number*

{shipment id}

the appropriate shipment ID*

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 Shipment Public Key Info service does not require any input XML data.

Response Details

Response – Elements

The following table describes the XML fields in the response.

Get Non-Contract Shipment Public Key Info – Response Elements
Element Name Type Description

non-contract-shipment-public-key-info

Complex

The top level element of the XML structure.

expiry-date

Simple

Provides when the public URL is valid till

url

Simple

Provides un-authenticated url to the label

qr-code

Simple

TIt encodes the public url (base64 encode)

Response – XML Diagram

The following diagram shows the top level structure of the XML response to this service.

Get Shipment Public Key Info Response XML Diagram (REST)
Get Non-Contract Shipment Public Key Info Response XML Diagram (REST)

Response – Possible Error Responses

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

Examples

Sample REST XML Request – Get Non-Contract Shipment Public Key Info

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

Sample REST XML Response – Get Non-Contract Shipment Public Key Info

<non-contract-shipment-public-key-info xmlns="http://www.canadapost.ca/ws/ncshipment-v4">
<expiry-date>2023-08-18T23:59:59-04:00</expiry-date>
<url>https://stg12.canadapost-postescanada.ca/printlabel-imprimeretiquette?key-cle=328e7bfb331640a3bd1deabb07e9dd72</url>
<qr-code>/9j/4AAQSkZ...</qr-code>
</non-contract-shipment-public-key-info >