Sunday Holiday API

 

USPS Web Tools™

Application Programming Interface

用户指南

Version 1.0 (3/1/2021)

 

 

 

 

 

 

 

 

 


 


目录

1.0         Introduction to Web Tools. 4

1.1            Before you get started: 4

2.0         Sunday Holiday API 4

2.1            Overview. 4

2.1.1      API Signature. 4

2.2            Request Tag Descriptions. 4

2.2.1      Request Sample. 5

2.3            Response Tag Descriptions. 6

2.3.1      Response Sample. 6


1.0        Introduction to Web Tools

This document contains a Reference Guide to the USPS Sunday Holiday API. See the Developers Guide to learn the administrative process for gaining access to the Web Tools APIs as well as the basic mechanism for calling the APIs and processing the results. The Developer’s Guide also contains information on testing and troubleshooting.

备注: The Request Parameter sections present the XML input tags for generating live requests along with the restrictions on the values allowed. An error message will be returned if an incorrect value is entered.  Also, be aware of the maximum character amounts allowed for some tags. If the user enters more than those amounts, an error will not be generated. Web Tools will simply pass in the characters up to the maximum amount allowed and disregard the rest. This is important since the resulting value could prevent a correct response.

When building the XML request, pay particular attention to the order and case for tags. An error message will be returned if an incorrect value is entered. Remember that all data and attribute values in this document are for illustration purposes and are to be replaced by your actual values. For instance, a line of sample code may be:

<TrackID> EJ123456780US </TrackID>

In this instance, you will replace “EJ123456780US” with the tracking ID for the package.

1.1         Before you get started:

For information on registering and getting started with Web Tools, please refer to the Step-By-Step guide found on the Web Tools Technical Documentation Page.

2.0        Sunday Holiday API

2.1         Overview

The Sunday Holiday API allows customers to request information on package availability for Sunday’s and/or Holidays for a given zip code pairing. For information on USPS Holidays, please visit https://about.usps.com/newsroom/events/.

2.1.1     API Signature

Scheme

Host

小道

API

XML

https://

secure.shippingapis.com

/shippingapi.dll?

API=SundayHolidayAvailability

&XML=(see Tag Descriptions below)

2.2         Request Descriptions

Tag Name

Occurs

描述

类型

Validation

SundayHolidayRequest

需要

API = SundayHolidayRequest

(Alias)

 

SundayHolidayRequest / SundayHoliday / USERID

需要

This attribute specifies your WebTools ID. See the Developers Guide for information on obtaining your USERID

例如:

<USERID=”XXXXXXXXXX”>

NMTOKEN

 

SundayHolidayRequest / SundayHoliday

需要

Select Sunday or Holiday

String

Sunday or Holiday

SundayHolidayRequest / FromZipCode

需要

5 digit ship from Zip

String

 

SundayHolidayRequest / ToZipCode

需要

5 digiit ship to zip

String

 

SundayHolidayRequest

需要

API = SundayHolidayRequest

(Alias)

 

2.2.1     Sample Request

Request: SundayHoliday

<SundayHolidayRequest USERID="XXXXXXXXXXXX">

<SundayHoliday>Sunday</SundayHoliday>

<FromZipCode>18702</FromZipCode>

<ToZipCode>90210</ToZipCode>

</SundayHolidayRequest>

 

 

 

 

 

2.3         Response Descriptions

Tag Name

Occurs

描述

类型

Validation

SundayHolidayResponse

需要

API = SundayHolidayResponse

(Alias)

 

SundayHolidayResponse / Delivery

需要

Returns whether the lane Is eligible for delivery on day type selected.

String

Enumeration=

·        Yes

·        No

SundayHolidayResponse / Error

Optional

Returns when error occurs

String

 

SundayHolidayResponse

需要

API = SundayHolidayResponse

(Alias)

 

2.3.1     Sample Response

《response: SundayHoliday – Delivery Available

<SundayHolidayAvailabilityResponse>

<DeliveryAvailability>Yes</DeliveryAvailability>

</SundayHolidayAvailabilityResponse>

 

《response: SundayHoliday – Delivery Unavailable

<SundayHolidayAvailabilityResponse>

<DeliveryAvailability>No</DeliveryAvailability>

</SundayHolidayAvailabilityResponse>

 

《response: SundayHoliday – Invalid Origin Zip Code

<Error>

<Number>-2147218250</Number>

<Source>clsSundayHoliday:ValidateParameters</Source>

<Description>Please enter a numeric From Zip Code.</Description>

<HelpFile/>

<HelpContext/>

</Error>

 

《response: SundayHoliday – Invalid Destination Zip Code

<Error>

<Number>-2147218250</Number>

<Source>clsSundayHoliday:ValidateParameters</Source>

<Description>Please enter a numeric To Zip Code.</Description>

<HelpFile/>

<HelpContext/>

</Error>

 

 

Powered by Translations.com GlobalLink OneLink SoftwarePowered By OneLink