Contract Shipping

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

Get Shipment Public Key Info – REST

Summary

Name: Get 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 Shipment
Get Shipment
Typical Next Call: N/A
Version history: Release notes
Get Shipment Public Key Info – Summary of Service

Get Shipment Public Key Info – Summary of Service

Request Details

Request – Structure for Get Shipment Public Key Info

Endpoint

Invoke the link from one of these prior calls: Create shipment where rel="publicKeyInfo" (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 Public Key Info service does not require any input XML data.

Response Details

Response – Elements

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

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

It 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 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 Shipment Public Key Info more than 90 days after the link was provided.

See HTTP status codes for more information.

Examples

Sample REST XML Request – Get Shipment Public Key Info

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

Sample REST XML Response – Get Shipment Public Key Info

<shipment-public-key-info xmlns="http://www.canadapost.ca/ws/shipment-v8">
<expiry-date>2024-01-15T23:59:59-05:00</expiry-date>
<url>https://canadapost-postescanada.ca/printlabel-imprimeretiquette?key-cle=c105151641f343cf9fa32ee519b439d2</url>
<qr-code>/9j/4AA...</qr-code>
</shipment-public-key-info>