Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. net. Security;
Using system. Security. cryptography. x509certificates;
Using system. net;
Using system. IO;
Using system. Io. compression;
Using system. Text. regularexpressions;
Using system. Web. Script. serialization;
Namespace weizhang
{
Class Program
{
Static void main (string [] ARGs)
{
String name = "ca5901 ";
String key = "**********************"; // applied key value
String url = "http://apis.haoservice.com/plan/s? Name = "+ name +" & Key = "+ key;
WebClient WC = new WebClient ();
WC. Encoding = encoding. utf8;
String STR = WC. downloadstring (URL );
Console. writeline (STR );
Console. readkey ();
}
}
}
URL: http://apis.haoservice.com/plan/s
Supported format: JSON
HTTP Request Method: Get post
Demo: http://apis.haoservice.com/plan/s? Name = ca5901 & Key = yourkey
Return example:
{
"Error_code": 0,
"Reason": "successful ",
"Result ":[
{
"Name": "hu7779", // flight no.
"Complany": "Hainan Airlines Co., Ltd.", // airline
"Airmodel": "738", // Model
"Airage": NULL, // machine year
"Start": "Beijing", // departure city
"End": "Sanya", // target City
"Depcode": "Beijing", // departure city pinyin
"Arrcode": "Sanya", // city pinyin
"Startairport": "Capital Airport", // departure airport
"Endairport": "Phoenix airport", // arrival airport
"Status": "Arrival", // real-time aircraft status
"Deptime": "", // planned departure time
"Arrtime": "10: 40", // scheduled arrival time
"Dexpected": "06:45", // estimated departure time
"Aexpected": "10: 40", // estimated arrival time
"Dactual": "", // real-time departure time
"Aactual": "10: 20", // real-time arrival time
"Food": "meals available", // no meals available
"Ontimerate": NULL, // punctuality Rate
"Flytime": "3 hours and 32 minutes", // flight time
"Distance": "2710", // flight distance
"Averagedelay": NULL, // average latency
"Scheduledaysofweek": "1, 2, 3, 4, 5, 6, 7" // schedule (the number of weeks for this flight is separated by commas (,), for example, four days in a week: 1, 2, 5, 7)
}
]
}
Note:
For flight query, you must first have a key value, and then enter the flights you want to query;
If an error occurs, view the code table on this web page (http://www.haoservice.com/docs/4/query.
Recipe query interface document