Express Ticket query Free API interface (PHP example)

Source: Internet
Author: User
Tags http post php example ticket

Express Number query API, can docking shun Fung Express inquiries, Postal Express inquiries, such as the Express query. These express logistics enterprises, provide the automatic identification of the express number of interface, courier tracking query interface and other Express logistics services. For e-commerce enterprises, ERP service enterprises, integration of this interface into their own software, increase the competitiveness of enterprises. However, there is a drawback, need to receive the major express companies, respectively, debugging interfaces, high maintenance costs, inconvenient management. Recommend a courier Query API free docking service platform, fast treasure open platform.

First, the interface application scenario

1. After the e-commerce platform after shopping, through the purchase order tracking logistics, call this API to get logistics information details

2. Handling freight reconciliation, a key to obtain the Waybill logistics status

3. Batch tracking and acquisition of Waybill Logistics information

Second, docking preparation

1. Registered fast-Treasure open platform, registered address: Http://open.kuaidihelp.com/register

2. Get Developer account information (ID, API Key) and view it in the console

3. Carry out technical adjustment, and complete commissioning, logistics query API address: http://open.kuaidihelp.com/api/1003

4. Integrated Express Logistics query interface in your software

Third, technology docking

Fast Treasure open platform to provide the Express query interface, support more than 110 express logistics inquiries, covering the domestic mainstream courier service Enterprise tracking number, timely information, data integrity.

Interface Name: Express.info.get
Official address: Https://kop.kuaidihelp.com/api
Request method: HTTP POST
Request method encoding format: Utf-8

Public Request Parameters ↓

name type whether you must Description
Method String Is API Interface Name
app_id String Is User ID (assigned when open platform is registered, view in console)
Sign String Is Verification legitimacy signatures generated by rules (MD5 (app_id + method + ts + api_key))
Ts String Is Timestamp of the current request
Data String Is JSON format request parameter settings

Public response Parameters ↓

name type whether you must Description
Code Int Is Response status Code. 0-Success, not 0-failed download and view details
Msg String Is Return result description
Uid String Is This request only business serial number
Data String Is JSON format response data

Request Parameters ↓

Name Type Whether you must lose Describe
Waybill_no String Is Logistics number, multiple ticket with "," separated, up to 10
Exp_company_code String Is Support brand abbreviation Please view the brand list download and view details

Response Parameters ↓

name type whether you must Description
Code Int Is Response status Code. 0-Success, not 0-failure
Msg String Is Return result description
Data String Is JSON format response data

Request code Example ↓

Support for 6 development language docking, including Java,c#,php,python,node.js,crul; Depending on your development language, select the reference code sample, which is given in the PHP code as an example:

1 $host= "Https://kop.kuaidihelp.com/api";2 $method= "POST";3 $headers=Array();4 //According to the requirements of the API, define the corresponding Content-type5 Array_push($headers, "Content-type". ":". " application/x-www-form-urlencoded; Charset=utf-8 ");6 $querys= "";7 $bodys= [8"app_id" = ' 50001 ',9"Method" = ' express.info.get ',Ten"Sign" = "bdf3b5f50865ac813cbdfd6c9b572b79", One"ts" = ' 1524209949 ', A"Data" = ' {"Waybill_no": "Logistic number is separated by commas", "Exp_company_code": "Brand abbreviation"} ' - ]; - $bodys=Http_build_query($bodys); the $url=$host; - $curl=curl_init (); -curl_setopt ($curl, Curlopt_customrequest,$method); -curl_setopt ($curl, Curlopt_url,$url); +curl_setopt ($curl, Curlopt_httpheader,$headers); -curl_setopt ($curl, Curlopt_failonerror,false); +curl_setopt ($curl, Curlopt_returntransfer,true); Acurl_setopt ($curl, Curlopt_header,true); at if(1 = =Strpos("$".$host, "https://")) - { -curl_setopt ($curl, Curlopt_ssl_verifypeer,false); -curl_setopt ($curl, Curlopt_ssl_verifyhost,false); - } -curl_setopt ($curl, Curlopt_postfields,$bodys); in Var_dump(Curl_exec ($curl));

Successful Response Example ↓

Response (success, failure) example, only JSON format is supported.

1 {2 "code": Int03 "MSG": string "Query succeeded"4 "Data": [5 0:{6 "No": string "3339809700595"7 "brand": String "sto"8 "status": String "signed"9 "Data": [Ten 0:{ One "Time": string "2017-10-03 19:11:00" A "Context": "string" has been signed, the signature is signed. - } - 1:{ the "Time": string "2017-10-03 08:14:33" - "context": string "Express has arrived in Zhejiang Pujiang Company" - } - 2:{ + "Time": string "2017-10-03 01:09:41" - "context": string "from Zhejiang Yiwu Transit department sent to Zhejiang Pujiang Company" + } A ] at "Order": String "desc" - } - ] -}

Failure response Example ↓

1 {2"code": string "error code"3"MSG": string "error message"4"" Data ": {}  5 }

Error code

Error code Description
201102 Request parameter Error
201103 Not supported by Express brand
201101 Query no record

-The end-

Express Ticket query Free API interface (PHP example)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.