Rating

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

Get Option – REST

Summary

Name: Get Option
Reason to Call: Used to retrieve details of a given option.
Input: Option code or link from Get Service where rel=option
Output: Option description, prerequisites and conflicts
Typical prior call: Get Service
Version history: Release notes
Get Option – Summary of Service

Get Option – Summary of Service

Request Details

Request – Structure for Get Option

Endpoint

Invoke the link provided from Get Service where rel=option (see Provided endpoints)

HTTP Headers

HTTP Header Variable

Value

Accept

from media-type in original link (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 Option 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.

Element Name type Description

option

complex

Structure containing the option and its attributes.

option-code

simple

The option-code whose attributes are being detailed

option-name

simple

Name of the option in chosen language.

option-class

simple

FEAT | DI | NDI

FEAT indicates that this option is a service feature.

DI indicates that this is a delivery instruction.

NDI indicates that this is an instruction in the case of unsuccessful delivery.

prints-on-label

simple

True | False

Indicates that evidence of this option selection is printed on the label.

qualifier-required

simple

True | False

True indicates that when this option is used in a Rate request or Create Shipment request, a qualifier for the option is required.

conflicting-options

complex

List of codes that cannot be selected at the same time as this option.

option-code

simple

An option that is mutually exclusive with the option specified in the option request.

prerequisite-options

complex

List of codes that are required to support this option.

option-code

simple

An option that must also be selected when the option specified in the option request is selected.

Response – XML Diagram

Diagram of successful XML Response to Get Option

Diagram of successful XML Response to Get Option

Response – Possible Error Responses

No errors are expected for invocation of this service from a provided link. If this service is constructed, the error 404 – Not Found could occur.

See HTTP status codes for general error handling information.

Examples

Sample REST XML Request – Get Option

GET https://XX/rs/ship/option/SO
Content-type:application/vnd.cpc.ship.rate-v4+xml

Sample REST XML Response – Get Option

HTTP/1.1 200 OK
Content-Type:application/vnd.cpc.ship.rate-v4+xml

<option>
<option-code>SO</option-code>
<option-name>Signature option</option-name>
<option-class>FEAT</option-class>
<prints-on-label>true</prints-on-label>
<qualifier-required>false</qualifier-required>
<conflicting-options>
<option-code>LAD</option-code>
</conflicting-options>
<prerequisite-options>
<option-code>DC</option-code>
</prerequisite-options>
</option>