Find a Post Office

Code Samples for Find a Post Office: Java (.zip) | PHP (.zip) | C# (.zip)

Get Post Office Detail – REST

Summary

Name: Get Post Office Detail
Reason to Call: To retrieve additional information about a specific Post Office
Input: Link provided from Get Nearest Post Office where rel=detail
Output: Detailed information on the specified Post Office (hours of operation, etc.)
Typical Prior Call: Get Nearest Post Office
Version history: Release notes

Request Details

Request – Structure for Get Post Office Detail

Endpoint

Invoke the link provided from Get Nearest Post Office where rel=detail (see Provided endpoints)

HTTP Headers

HTTP Header Variable

Value

Accept

application/vnd.cpc.postoffice+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 Post Office Detail service does not require any input XML data.

Response Details

Response – Elements

The following XML elements are returned in the response. For a complete view of the structure, see the diagram.

Get Post Office Detail – Response Elements
Element Name Type Description

post-office-detail

complex

The top level XML element for the response structure. It represents the information about a single Post Office.

address

complex

This XML structure represents the information on the address of the Post Office.

city

simple

Municipality in which the Post Office is located.

latitude

simple

The latitude of the Office.

longitude

simple

The longitude of the Post Office.

postal-code

simple

The Postal Code of the Post Office.

province

simple

The province where the Post Office is located.

office-address

simple

Street number and name for a Post Office.

location

simple

The general location or area of a Post Office. This is used to distinguish among various Post Office locations that have similar names.

name

simple

The franchise name assigned to Post Office, if it is a franchise.

office-id

simple

The internal Canada Post assigned unique identification number for the Post Office.

Note: leading zeroes are significant and should be included.

bilingual-designation

simple

true | false

  • True indicates that the Post Office provides bilingual services (English and French).
  • False indicates no designation for the provision of bilingual services. False does not indicate a specific language of service.

hours-list

complex

Contains information regarding the hours of operation of the Post Office.

Occurs 1 … 7 times, with each occurrence representing the hours of operation of a single day of the week.

day

simple

Indicates which day of the week the corresponding occurrence of hours-list represents.

Day 1 is Sunday and Day 7 is Saturday

time

simple

The opening and closing times of the Post Office.

Occurs 1 .. 4 times.

The first occurrence of time is the first opening time of the day.

The second occurrence (if present) represents the first closing time of the day. (If absent, then the store remains open to the end of the day)

The third occurrence (if present) represents a second opening of the day.

The fourth occurrence (if present) represents the second closing time of the day. (If absent, then the store remains open to the end of the day).

e.g., if there are 4 occurrences of the time with the values
09:00, 16:00, 19:00, 23:00, then the store would be open from 9 a.m. – 4 p.m. and 7 p.m. – 11 p.m.

Response – XML Diagram

Response – Possible Error Responses

For possible error responses, see HTTP status codes and Error messages and mitigation strategies.

Examples

Sample REST XML Request – Get Post Office Detail

There is no XML related to this REST request. Use the link provided by a prior request or see the soapUI project files for request examples.

Sample REST XML Response – Get Post Office Detail

<post-office-detail>
<address>
<city>GATINEAU</city>
<latitude>45.5856</latitude>
<longitude>-75.4132</longitude>
<postal-code>J8L1N0</postal-code>
<province>QC</province>
<office-address>563 RUE BELANGER</office-address>
</address>
<location>BUCKINGHAM PO</location>
<name>DÉPANNEUR MAUZEROLL</name>
<office-id>0000319376</office-id>
<bilingual-designation>true</bilingual-designation>
<hours-list>
<day>1</day>
<time>08:00</time>
<time>00:00</time>
</hours-list>
<hours-list>
<day>2</day>
<time>08:00</time>
<time>00:00</time>
</hours-list>
<hours-list>
<day>3</day>
<time>08:00</time>
<time>00:00</time>
</hours-list>
<hours-list>
<day>4</day>
<time>08:00</time>
<time>00:00</time>
</hours-list>
<hours-list>
<day>5</day>
<time>08:00</time>
<time>00:00</time>
</hours-list>
<hours-list>
<day>6</day>
<time>08:00</time>
<time>00:00</time>
</hours-list>
<hours-list>
<day>7</day>
<time>08:00</time>
<time>00:00</time>
</hours-list>
</post-office-detail>