Shipping

Code Samples

Get Artifact – SOAP

Summary

Name: Get Artifact
Reason to Call:

To retrieve a shipping label, a return label, or the paperwork required for shipment pickup or drop-off (manifest).

Note: For labels, you can call Get Artifact a second time if the original label is destroyed, but the same label with the original barcode is returned each time. You cannot use copies on separate parcels.

Input: artifact-id; page index; locale (optional)
Output: PDF or ZPL II document
Error Examples: Invalid artifact-id
Typical Prior Call: Create Shipment, Get Shipment, Get Manifest or Create Authorized Return
Typical Next Call: Get Shipment Price, Get Manifest Details
Version history: Release notes
Get Artifact – Summary of Service

Get Artifact – Summary of Service

Call Details

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

SOAP Body

This section describes the XML input elements to this service. For the hierarchical structure, see the XML diagram.

Get Artifact – Request Elements
Element Name Type Required / Optional Description

get-artifact-request

complex

required

The top level XML element for the request input information.

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.

artifact-id

simple

required

(Numeric String – up to 18 digits)

A unique identifier for the artifact (label or manifest) that was generated as part of a previous call. You can only retrieve artifacts for shipments, manifests or returns that you created.

page-index

simple

optional

To retrieve pdf documents, this element is not required or must be zero.

Request – XML Diagram

Get Artifact –Structure of the XML Request

Get Artifact –Structure of the XML Request

Response Details

Response – Elements

The following table describes the XML elements in the response to Get Artifact. For the hierarchy of the response, see the XML diagram.

Get Artifact – Response Elements
Element Name Type Description

get-artifact-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.

artifact-data

complex

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

image

simple

The image of the label or manifest.

The data provided is a Base64 encoding of the actual image. For pdfs the encoded file contains binary data.

mime-type

simple

The mime-type of the image file (after Base64 decoding):

  • image/pdf
  • image/zpl

Response – XML Diagram

Get Artifact – Structure of the XML Response

Get Artifact – Structure of the XML Response

Response – Possible Error Responses

You will receive a 404 error if you invoke Get Artifact more than 90 days after the artifact-id was created. If you are using Get Artifact to retrieve an authorized return label, you have only 5 calendar days to retrieve the label after you have created it.

The response to error conditions for this web service follows the standard SOAP error response approach used for all Canada Post web services. For more information, see SOAP Fundamentals of Canada Post Web Services.

Examples

Sample SOAP XML Request – Get Artifact

<get-artifact-request>
<locale>EN</locale>
<artifact-id>10238</artifact-id>
<page-index>0</page-index>
</get-artifact-request>

Sample SOAP XML Response – Get Artifact

<get-artifact-response>
<artifact-data>
<image>JVBERi0xLj(Etc... base 64 Encoded PDF)</image>
<mime-type>application/pdf</mime-type>
</artifact-data>
</get-artifact-response>