Fedex Logo
Developer Portal

Postal Code Validation API

บทนำ

API สำหรับตรวจสอบรหัสไปรษณีย์ของ FedEx จะช่วยให้ลูกค้าของ FedEx สามารถตรวจสอบรหัสไปรษณีย์และรับข้อตกลงการให้บริการ โดยจะรองรับการค้นหาและการตรวจสอบที่เกี่ยวข้องกับเมือง รหัสไปรษณีย์ ประเทศ รวมถึงต้นทางและปลายทาง ซึ่งจะส่งคืนรายละเอียดที่ทำการไปรษณีย์และศูนย์บริการที่ยืนยันแล้วในการตอบกลับ

รายละเอียด API สำหรับการตรวจสอบรหัสไปรษณีย์

การตรวจสอบรหัสไปรษณีย์จะตรวจสอบความถูกต้องของรหัสไปรษณีย์สำหรับประเทศและเมืองต่างๆ และระบุรหัสไปรษณีย์ที่สะอาดเป็นการตอบกลับ โดยรหัสไปรษณีย์ที่มีรูปแบบถูกต้องจำเป็นสำหรับการดำเนินการจัดส่งหรือฉลากการจัดส่ง

API นี้จะใช้ข้อมูลที่ป้อนเข้ามา เช่น วันที่จัดส่ง รหัสไปรษณีย์ รหัสประเทศ และข้อมูลอื่นๆ และตรวจสอบความไม่ตรงกันระหว่างค่าของรัฐและเมือง โดยระบบจะตั้งค่าเมืองและรัฐหากพบว่าไม่ตรงกัน และหากประเทศเป็นสหรัฐอเมริกาหรือแคลิฟอร์เนีย ตัวอย่างเช่น: FDXE - FedEx Express®, FDXG - FedEx Ground® และ FXSP - FedEx Ground® Economy (เดิมเรียกว่า FedEx SmartPost®). API จะตรวจสอบข้อมูลที่ป้อนเข้ามาและระบุรายละเอียดสถานที่และรหัสไปรษณีย์ที่สะอาด

FedEx รองรับบริการทั้งในประเทศที่ใช้รหัสไปรษณีย์และประเทศที่ไม่ใช้รหัสไปรษณีย์

ประเทศที่ใช้รหัสไปรษณีย์

การจัดส่งไปยังประเทศเหล่านี้ควรมีรหัสไปรษณีย์ในใบตราส่งสินค้าทางอากาศและเอกสารอื่นๆ เพื่อช่วยลดความล่าช้าและเพิ่มประสิทธิภาพให้สูงสุด โดยลูกค้า FedEx Express ควรได้รับการแนะนำให้ใส่รหัสไปรษณีย์ที่ถูกต้องในที่อยู่สำหรับผู้รับที่อยู่ในประเทศด้านล่าง

หากต้องการข้อมูลเพิ่มเติมเกี่ยวกับประเทศที่ใช้รหัสไปรษณีย์ กรุณาดูที่ ประเทศที่ใช้รหัสไปรษณีย์

ประเทศที่ไม่ใช้รหัสไปรษณีย์

ตามชื่อที่แนะนำ มีประเทศที่ไม่ใช้รหัสไปรษณีย์ที่ FedEx รองรับ ซึ่งไม่ได้บังคับให้ใช้รหัสไปรษณีย์ในการจัดส่ง รหัสรัฐหรือชื่อเมืองก็เพียงพอแล้วเมื่อลูกค้าจะจัดส่งไปยังประเทศที่ไม่มีรหัสไปรษณีย์ ทั้งนี้ หากเกิดข้อผิดพลาดในการตรวจสอบความถูกต้องสำหรับประเทศที่ไม่ได้ใช้รหัสไปรษณีย์ ให้ใช้ที่อยู่โดยป้อน \"00000\" เพื่อใช้แทนรหัสไปรษณีย์ ซึ่งการใช้รหัสไปรษณีย์ปลอมนี้จะไม่ทำให้เกิดปัญหาเนื่องจากไม่มีอยู่จริง

ต่อไปนี้เป็นประโยชน์ของการใช้ API สำหรับการตรวจสอบรหัสไปรษณีย์:

  • ลดความล่าช้าในการจัดส่งและเพิ่มประสิทธิภาพ
  • เพิ่มโอกาสในการส่งมอบที่ตรงเวลาและครบถ้วน
  • ปรับปรุงบริการ FedEx ไปยังพื้นที่เขตเมืองให้มีความยืดหยุ่นสำหรับเวลาตัดรอบและการนัดรับพัสดุ

API สำหรับการตรวจสอบรหัสไปรษณีย์ทำงานอย่างไร

การตรวจสอบรหัสไปรษณีย์ของ FedEx จะใช้ปลายทางด้านล่างเพื่อตรวจสอบรหัสไปรษณีย์สำหรับเมือง ประเทศ รวมถึงต้นทางและปลายทาง โดยส่วนต่อไปนี้จะอธิบายถึงข้อมูลสำคัญและการตอบสนองสำหรับปลายทาง:

ตรวจสอบที่ทำการไปรษณีย์

คำขอนี้ใช้เพื่อส่งคืนรายละเอียดทำการไปรษณีย์ รหัสไปรษณีย์ที่สะอาดและคำอธิบายตำแหน่งตามรายละเอียดข้อมูลที่ป้อนเข้ามา โดยข้อมูลสำคัญที่เกี่ยวข้องกับคำขอนี้มีดังต่อไปนี้:

  • รหัสผู้ให้บริการขนส่ง
  • รหัสประเทศ
  • รหัสรัฐหรือจังหวัด
  • รหัสไปรษณีย์
  • วันที่จัดส่ง

ผลลัพธ์ที่สำเร็จของคำขอนี้คือ locationdetails และcleanedpostalcode สำหรับข้อมูลที่ป้อนให้ โดยคำขอจะล้มเหลวหากรหัสไปรษณีย์ไม่ถูกต้อง เช่น การรวมรหัสประเทศ รัฐ/ จังหวัด และรหัสไปรษณีย์ไม่ถูกต้อง

คำชี้แจงความเข้าใจผิดที่พบบ่อย

  • การอ้างอิงการจัดอาณาเขตกับการจัดรหัสไปรษณีย์เป็นไปไม่ได้เนื่องจากสิ่งเหล่านี้เป็นข้อมูลที่ประมวลผลแยกกันอย่างชัดเจน
  • ไม่ใช่ทุกสถานที่ทางภูมิศาสตร์ในโลกที่มีรหัสไปรษณีย์

หากต้องการข้อมูลเพิ่มเติมเกี่ยวกับรายการเฉพาะภูมิภาค กรุณาดูที่ รายการบริการเฉพาะภูมิภาค

กฎการดำเนินธุรกิจ

  • ต้องรวมบ้านเลขที่ ชื่อถนน ฯลฯ อย่างน้อยหนึ่งบรรทัดสำหรับที่อยู่จริง และที่อยู่จะต้องไม่เว้นว่างไว้
  • ต้องระบุรหัสรัฐหรือจังหวัด 2 ตัวอักษรหากประเทศของผู้รับคือสหรัฐอเมริกาหรือแคนาดา หรือหากใช้ EEI และประเทศคือเม็กซิโก {MX}
  • อาจใช้ข้อมูลเชิงบรรยายสำหรับสถานที่ตั้งจริงเป็นที่อยู่จริง (สถานที่ที่สามารถไปได้) หรือเป็นคอนเทนเนอร์ของ \"ส่วนที่อยู่\" ซึ่งควรจัดการเป็นหน่วย (เช่น การรวมเมือง รัฐ และรหัสไปรษณีย์ภายในสหรัฐอเมริกา)
  • รูปแบบและการแสดงของช่องรหัสไปรษณีย์จะแตกต่างกันไปตามแต่ละประเทศ

คอลเล็กชัน JSON API

Postal Code Validation API (1.0.0)

Validate Postal

Use this endpoint to validate postal codes and service commitments. Supports city, postal, country and origin-destination related lookups and validations.
Note: FedEx APIs do not support Cross-Origin Resource Sharing (CORS) mechanism.

header Parameters
x-customer-transaction-id
string
Example: 624deea6-b709-470c-8c39-4b5511281492

This element allows you to assign a unique identifier to your transaction. This element is also returned in the reply and helps you match the request to the reply.

content-type
required
string
Example: application/json

This is used to indicate the media type of the resource. The media type is a string sent along with the file indicating format of the file.

x-locale
string
Example: en_US

This indicates the combination of language code and country code. Click here to see Locales

authorization
required
string
Example: Bearer XXX

This indicates the authorization token for the input request.

Request Body schema: application/json
One of
  • FullSchema-ValidatePostal
  • MinimumSamplePayload
carrierCode
required
string
Enum: "FDXE" "FDXG" "FXSP" "FDXC" "FXCC"

Specify the four letter code of a FedEx operating company that meets your requirements
Examples of FedEx Operating Companies are:

  • FDXE - FedEx Express
  • FDXG - FedEx Ground
  • FXSP - FedEx SmartPost
  • FXCC - FedEx Custom Critical.

countryCode
required
string

The two-letter code used to identify a country.
Example:US
Click here to see Country Codes

stateOrProvinceCode
required
string

This is the state or province code. Format and presence of this field will vary, depending on country.
Example: US
Click here to see State Or Province Code

postalCode
required
string

Identification code of a region (usally small) for easier and accurate mail/package delivery. The format and presence of this field may vary depending on the country.
Example: 75063-8659
Click here to see Postal aware countries

shipDate
required
string

Specify the date on which the package is to be shipped. The specified date should not be the current date or any date, 10 days after the current date. The date format must be YYYY-MM-DD.
Example: 2019-10-04

routingCode
string

Specify the routing code for the shipment. Routing code is the information that identifies the route the package or shipment may take.
Example: Memphis 38017 - HKA/NQA

checkForMismatch
boolean

This element checks for mismatch between State/Province Code and Postal Code.

  • When the checkForMismatch is set TRUE, for U.S. and Canada: The values in State/Province Code are checked with respect to Postal Code provided. If these entries are valid, the response provides respective State/Province Code and Postal Code. In case of mismatch of Postal Code and State/Province Code an error message is displayed.
  • When the checkForMismatch is set FALSE, for U.S. and Canada: The values in State/Province Code are not checked with respect to Postal Code provided. Instead the given data is reflected in the response.

For regions other than U.S and Canada regardless of the value of checkForMismatch the State/Province Code are checked with respect to the Postal Code and the response provides the respective State/Province Code and Postal Code.

Responses

200

Success

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Failure

503

Service Unavailable

post /country/v1/postal/validate

Sandbox Server

https://apis-sandbox.fedex.com/country/v1/postal/validate

Production Server

https://apis.fedex.com/country/v1/postal/validate

Request samples

Content type
application/json
Example
Copy
Expand all Collapse all
{
  • "carrierCode": "FDXG",
  • "countryCode": "US",
  • "stateOrProvinceCode": "US",
  • "postalCode": "502267",
  • "shipDate": "2019-10-04",
  • "routingCode": "Memphis 38017 - HKA/NQA",
  • "checkForMismatch": true
}

Response samples

Content type
application/json
Copy
Expand all Collapse all
{
  • "transactionId": "624deea6-b709-470c-8c39-4b5511281492",
  • "customerTransactionId": "AnyCo_order123456789",
  • "output":
    {
    }
}
CLOSE

Response

Copy