Get Service Info
Get Service Info – REST
Summary
Name: | Get Service Info |
---|---|
Reason to Call: | To allow you to retrieve and display informational messages for your e-commerce platform customers to inform them about upcoming outages to Canada Post web services. |
Input: | Fixed values as shown in the endpoint below. |
Output: |
|
Version history: | Release notes |
Request Details
Request – Structure for Get Service Info
This service does not require any input XML data. It contains fixed values and is invoked as follows:
Endpoint
GET https://XX/rs/serviceinfo/shipment?messageType=SO |
|
---|---|
Replace... | With... |
XX (Development) |
ct.soa-gw.canadapost.ca |
XX (Production) |
soa-gw.canadapost.ca |
HTTP Header Variable |
Value |
---|---|
Accept |
application/vnd.cpc.serviceinfo-v2+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 |
None
Response Details
Response – Elements
Get Service Info – Response Elements | ||
---|---|---|
Element Name | Type | Description |
info-messages |
Complex |
The overall structure for the response in XML format. |
info-message |
Complex |
Contains the details of a specific message. |
message-type |
Simple |
Type of message. Always SO (scheduled outage). |
message-text |
Simple |
Text of the message in the language you specified in the header. |
from-datetime |
Simple |
Start date and time of the outage in dateTime format (2013-06-07T21:00:00-05:00). Note: The message will be returned ahead of this time for advance notice. |
to-datetime |
Simple |
The expected end date and time for the scheduled outage in dateTime format (2013-06-08T03:00:00-05:00). Note: The message will continue to be returned beyond this time in the event that the outage extends beyond the expected end time. |
Response – Possible Error Responses
A correctly structured request may receive the following error responses.
If there is no pending message (i.e. there is no message or we are not within the date/time range a message is to be released to users), an HTTP error code of 200 (OK) is returned with an empty response, i.e., <info-messages></info-messages>.
If a component is missing or invalid in the request or a validation fails, an HTTP error code of 400 (Bad Request) is returned, with one of the following errors returned in the body of the XML response.
Code | Message |
---|---|
9182 |
The Message Type is invalid. |
Response – XML Diagram
Examples
Sample REST XML Request – Get Service Info
GET https://www.canadapost.ca/rs/serviceinfo/shipment?messageType=SO
Accept: application/vnd.cpc.serviceinfo-v2+xml
Authorization: s7HD7gwsennesc==
Accept-Language: en-CA
Sample REST XML Response – Get Service Info
<info-messages xmlns="http://www.canadapost.ca/ws/shipment-v2">
<info-message>
<message-type>SO</message-type>
<message-text>Please note that we will be performing scheduled maintenance from Saturday, Oct. 12 at 9 p.m. to Sunday, Oct. 13 at 4 a.m. EDT. During this time, Canada Post web services will not be available.</message-text>
<from-datetime>2013-10-12T21:00:00-05:00</from-datetime>
<to-datetime>2013-10-13T04:00:00-05:00</to-datetime>
</info-message>
</info-messages>