Contract Shipping

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

Get Manifest – REST

Summary

Name:

Get Manifest

Reason to Call:
  • A mandatory call that must be made to create a manifest. You need a successful response from Get Manifest to confirm that a manifest has been successfully created. The response will include a link that allows you to retrieve the manifest label by a call to Get Artifact.
  • Also used to retrieve the PO number so you can use it to cancel a manifest.
Input:

Invoke the link(s) returned from Transmit Shipments where rel="manifest"

Output:

The following information for the specific manifest

  • the PO number of the manifest
  • A link to retrieve the manifest hardcopy (rel="artifact")
  • A link to get the manifest details (rel="details")
  • A link to get links for all shipments contained within the manifest (rel="manifestShipments")
  • A link to retrieve this output again (rel="self")
Error Example:

404 – not found

Typical Prior Call:

Transmit Shipments, Get Manifests

Typical Next Call:

Get Artifact, Get Manifest Details

Version history: Release notes
Get Manifest – Summary of Service

Get Manifest – Summary of Service

Request Details

Request – Structure for Get Manifest

Endpoint

Invoke the link(s) returned from a prior call where rel=”manifest” (see Provided endpoints)

HTTP Headers

HTTP Header Variable

Value

Accept

application/vnd.cpc.manifest-v8+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 Manifest service does not require any input XML data.

Response Details

Response – Elements

The following table describes the XML fields in the response.

For a detailed view of the hierarchy of the response, see the diagram below.

Get Manifest – Detailed View of Response Elements
Element Name Type Description

manifest

Complex

This is the top level of the structure.

customer-request-id

Simple

For Future Use.

po-number

Simple

(Alphanumeric string up to 10 letters/digits)

Contained within manifest.

This is the PO number for the manifest, except for an empty manifest where it is always set to EMPTY. (See Transmit Shipments for details).

links

Complex

Contained within manifest.

This structure contains the links to the artifacts and the details of the specific manifest.

link

Complex

Contained within manifest-links.

May occur 1 … N times. However, at the current time, there are four links:

  1. rel="self"
  2. rel="artifact"
  3. rel="details"
  4. rel="manifestShipments"

Each link allows you to retrieve different information about the manifest.

For a description of link attributes, see Provided endpoints.

  1. rel="self"

    This represents a repeat of the original Get Manifest call used to get this list of links.  It can be stored for later use.

  2. rel = "artifact"

    This link will return a PDF file to be printed to allow pickup or drop-off of the associated physical shipments. See Get Artifact.

  3. rel = "details"

    This link returns details found on the hardcopy manifest such as a summary of shipments and the total cost of the manifest. See Get Manifest Details.

    Note: This link would not be returned for an empty manifest (see Transmit Shipments for details).

  4. rel – "manifestShipments"

    This link will return links to every shipment in the manifest. See Get Shipments.

    Note: This link would not be returned for an empty manifest (see Transmit Shipments for details).

(Note: the XML element link is "Complex" because it contains a number of attributes. The link element does not contain any sub-elements)

Response – XML Diagram

Note: the attribute "index" of the link element pictured below is not used in the Get Manifest service.

manifestResponseDiagram

Response – Possible Error Responses

See HTTP status codes for general information regarding error handling.

Possible "400" error messages for this service include the following.

Code Message
1182 The transaction could not be authorized. Please select another credit card or an alternate method of payment and retransmit the order.
1185 The transaction could not be authorized. Please select another account or an alternate method of payment and retransmit the order.

Possible "200" error messages for this service include the following.

Code Message
1653 Method of payment Account is not available. Please select another method of payment.

Possible "202" error messages for this service include the following.

Code Message
9153 The transmit process has not completed yet. Please try again later.

Possible "412" error messages for this service include the following.

Code Message
9154

A system error has occurred. Please try again later. If the problem persists, please contact the Canada Post help desk.

* You will receive this error if you are attempting to use Get Manifest (Artifact ID) service but the previous Transmit Shipment attempt failed.

Shipments are manifested asynchronously hence the error is returned on the following request.

The common cause of transmit failure is missing default credit card.

Examples

Sample REST XML Request – Get Manifest

GET https://XX/rs/1234567/1234567/manifest/123456789012345678
Accept:application/vnd.cpc.manifest-v8+xml
Authorization:Basic s7HD7gwsennesc==

Sample REST XML Response – Get Manifest

<manifest>
<po-number>P906367941</po-number>
<links>
<link rel="self" href="https://XX/rs/111111111/222222222/manifest/33333333" media-type="application/vnd.cpc.manifest-v8+xml"></link>
<link rel="details" href="https://XX/rs/111111111/222222222/manifest/666666666/details" media-type="application/vnd.cpc.manifest-v8+xml"></link>
</links>
</manifest>