码迷,mamicode.com
首页 > 其他好文 > 详细

航班查询接口

时间:2014-11-14 19:17:20      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:style   http   ar   os   sp   on   art   代码   bs   

航班查询接口

using System;

using System.Text;

using System.Net;

namespace plane

{

    class Program

    {

        static void Main(string[] args)

        {

            string name="CA5901";

            string key = "**********************";//申请的key

            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();

 

        }

    }

}

 

URLhttp://apis.haoservice.com/plan/s

支持格式:json

http请求方式:GET POST

DEMOhttp://apis.haoservice.com/plan/s?name=CA5901&key=yourkey

返回示例:

{

    "error_code": 0,

    "reason": "成功",

    "result": [

        {

            "name": "HU7779",//航班号

            "complany": "海南航空股份有限公司",//航空公司

            "AirModel": "738",//机型

            "AirAge": null,//机年

            "start": "北京",//起飞城市

            "end": "三亚",//降落城市

            "DepCode": "BeiJing",//起飞城市拼音

            "ArrCode": "SanYa",//降落城市拼音

            "startAirport": "首都机场",//起飞机场

            "endAirport": "凤凰机场",//降落机场

            "status": "到达",//飞机实时状态

            "DepTime": "06:45",//计划起飞时间

            "ArrTime": "10:40",//计划到达时间

            "Dexpected": "06:45 ",//预计起飞时间

            "Aexpected": " 10:40",//预计到达时间

            "Dactual": "06:48 ",//实时起飞时间

            "Aactual": " 10:20",//实时到达时间

            "food": "有餐食   ",//有无餐食

            "OnTimeRate": null,//准点率

            "FlyTime": "3小时32",//飞行时间

            "Distance": "2710KM  ",//飞行距离

            "AverageDelay": null,//平均延时

            "ScheduleDaysOfWeek": "1,2,3,4,5,6,7"//班期(有该航班的星期数,用英文逗号分隔,如一周中有4天:1,2,5,7)

        }

    ]

}

 

备注:

航班查询,要先有key,然后将自己想要查询的航班等输入;

若出现错误,请查看该网页(http://www.haoservice.com/docs/4/query)上的代码表.

 

 

 

 

 

 

航班查询接口

标签:style   http   ar   os   sp   on   art   代码   bs   

原文地址:http://www.cnblogs.com/wuiihui/p/4097867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!