Contract Shipping

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

Get Shipment Public Key Info – SOAP

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

Call Details

WSDL: shipment.wsdl
Endpoint (Development): https://ct.soa-gw.canadapost.ca/rs/soap/shipment/v8
Namespace: http://www.canadapost.ca/ws/soap/shipment/v8
Operation: GetShipmentPublicKeyInfo

SOAP Body

This section describes the XML input elements to this service.

Get Shipment Public Key Info – Request Elements
Element Name Type Required / Optional Description

get-shipment-public-key-info-request

Complex

Required

This is the overall XML structure for the request input information.

mailed-by

Simple

Required

(1-10 digit numeric)

The 10-digit customer number of the mailed-by customer.

If the number provided has fewer than 10 digits, the system will add leading zeros.

mobo

Simple

Optional

(1-10 digit numeric)

The 10-digit customer number of the mailed-on-behalf-of customer.

If this element is missing, it will default to the mailed-by customer number.

If the number provided has fewer than 10 digits, the system will add leading zeros.

When Mailed on Behalf is not equal to Mailed By, the Mailed By / MoBo combination must have been configured in the system before it can be used, to prevent fraud.

locale

Simple

Optional

Indicates your language preference for receiving error messages.

EN = English

FR = French

If no value is provided, the default language is English.

shipment-id

Simple

Required

(Alphanumeric String – up to 32 letters/digits)

An identification number representing the existing shipment for which information is being requested.

Note: Retrieve the shipment-id provided by previous calls to Create Shipment or Get Shipments. The output of those services will include a shipment-id element.

Request – XML Diagram

Get Shipment Details – Structure of the XML Request

getShipmentPublicKeyInfo Request XML Diagram (SOAP)

Response Details

Response – Elements

The following table describes the XML elements in the response to Get Shipment Public Key Info.

Get Shipment Details - Response Elements
Element Name Type Description

get-public-key-info response

Complex

The top level XML element for the response.

It will either contain the results of a successful completion or the error message structure.

shipment-public-key-info

Complex

The XML structure containing the results of a successful completion of the service.

expiry-date

Simple

Same as in the REST response.

url

Simple

Same as in the REST response.

qr-code

Simple

Same as in the REST response.

Response – XML Diagram

Getshipmentpublickeyinfo response XML diagram
Getshipmentpublickeyinfo response XML diagram

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.

Examples

Sample SOAP XML Request – Get Shipment Public Key Info

<v8:get-public-key-info-request>
<mailed-by>1234567</mailed-by>
<shipment-id>123456789012345678</shipment-id>
</v8:get-public-key-info-request>

Sample SOAP XML Response – Get Shipment Public Key Info

<tns:get-public-key-info-response>
<shipment-public-key-info>
<expiry-date>2024-01-22T23:59:59-05:00</expiry-date>
<url>https://canadapost-postescanada.ca/printlabel-imprimeretiquette?key-cle=7d8157cdba084043bdbd4b85a51d5fc9</url>
<qr-code>/9j/4AA...</qr-code>
</shipment-public-key-info>
</tns:get-public-key-info-response>