• 22
  • 19362
  • 126

12306火车票查询

聚合数据 支持HTTPS

火车时刻表、余票查询

  • API文档
  • 错误码参照
  • 示例代码
  • 联系我们
立即调用
接口地址:http://apis.juhe.cn/train/s
返回格式:json/xml
请求方式:get
请求示例:http://apis.juhe.cn/train/s?name=g4&key=您申请的APPKEY
接口备注:因列车时刻经常变化,提供的列车时刻表数据仅供参考,请以火车站当日售票信息为准。

请求参数说明:

名称 必填 类型 说明
  name string 车次名称,如:G4
  key string 在个人中心->我的数据,接口名称上方查看
  dtype string 返回数据的格式,xml或json,默认json

返回参数说明:

名称 类型 说明
  error_code int 返回码
  reason string 返回说明
  train_info - 返回结果集
    name string 列次名称
    start string 起点站
    end string 终点站
    starttime string 发车时间
    endtime string 到达时间
    mileage string 里程
  station_list - 站点列表
    train_id int 站点序号
    station_name string 站点名称
    arrived_time string 到达时间
    leave_time string 发车时间
    stay string 停留

JSON返回示例:

{
    "resultcode": "200",
    "reason": "Successed!",
    "result": {
        "train_info": {
            "name": "G656",
            "start": "西安北",
            "end": "北京西",
            "starttime": "10:10",
            "endtime": "16:27",
            "mileage": "1212km"
        },
        "station_list": [
            {
                "train_id": "1",
                "station_name": "西安北",
                "arrived_time": "-",
                "leave_time": "10:10",
                "mileage": "-",
                "fsoftSeat": "-",
                "ssoftSeat": "-",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "-",
                "swz": "-",
                "tdz": "-",
                "gjrw": "-",
                "stay": "-"
            },
            {
                "train_id": "2",
                "station_name": "渭南北",
                "arrived_time": "10:29",
                "leave_time": "10:31",
                "mileage": "63km",
                "fsoftSeat": "44.5",
                "ssoftSeat": "29.5",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "29.5",
                "swz": "90.5",
                "tdz": "-",
                "gjrw": "-",
                "stay": "2"
            },
            {
                "train_id": "3",
                "station_name": "华山北",
                "arrived_time": "10:51",
                "leave_time": "11:02",
                "mileage": "121km",
                "fsoftSeat": "89.5",
                "ssoftSeat": "54.5",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "54.5",
                "swz": "175.5",
                "tdz": "-",
                "gjrw": "-",
                "stay": "11"
            },
            {
                "train_id": "4",
                "station_name": "三门峡南",
                "arrived_time": "11:35",
                "leave_time": "11:37",
                "mileage": "257km",
                "fsoftSeat": "189.5",
                "ssoftSeat": "119.5",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "119.5",
                "swz": "372.5",
                "tdz": "-",
                "gjrw": "-",
                "stay": "2"
            },
            {
                "train_id": "5",
                "station_name": "渑池南",
                "arrived_time": "11:54",
                "leave_time": "11:56",
                "mileage": "315km",
                "fsoftSeat": "229.5",
                "ssoftSeat": "144.5",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "144.5",
                "swz": "456.5",
                "tdz": "-",
                "gjrw": "-",
                "stay": "2"
            },
            {
                "train_id": "6",
                "station_name": "洛阳龙门",
                "arrived_time": "12:15",
                "leave_time": "12:17",
                "mileage": "380km",
                "fsoftSeat": "279.5",
                "ssoftSeat": "174.5",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "174.5",
                "swz": "550.5",
                "tdz": "-",
                "gjrw": "-",
                "stay": "2"
            },
            {
                "train_id": "7",
                "station_name": "巩义南",
                "arrived_time": "12:31",
                "leave_time": "12:33",
                "mileage": "430km",
                "fsoftSeat": "314.0",
                "ssoftSeat": "199.0",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "199.0",
                "swz": "623.0",
                "tdz": "-",
                "gjrw": "-",
                "stay": "2"
            },
            {
                "train_id": "8",
                "station_name": "郑州",
                "arrived_time": "13:06",
                "leave_time": "13:09",
                "mileage": "505km",
                "fsoftSeat": "369.0",
                "ssoftSeat": "229.0",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "229.0",
                "swz": "731.0",
                "tdz": "-",
                "gjrw": "-",
                "stay": "3"
            },
            {
                "train_id": "9",
                "station_name": "郑州东",
                "arrived_time": "13:25",
                "leave_time": "13:28",
                "mileage": "519km",
                "fsoftSeat": "379.0",
                "ssoftSeat": "237.0",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "237.0",
                "swz": "749.0",
                "tdz": "-",
                "gjrw": "-",
                "stay": "3"
            },
            {
                "train_id": "10",
                "station_name": "邯郸东",
                "arrived_time": "14:21",
                "leave_time": "14:25",
                "mileage": "756km",
                "fsoftSeat": "536.0",
                "ssoftSeat": "335.0",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "335.0",
                "swz": "1059.0",
                "tdz": "-",
                "gjrw": "-",
                "stay": "4"
            },
            {
                "train_id": "11",
                "station_name": "石家庄",
                "arrived_time": "15:04",
                "leave_time": "15:07",
                "mileage": "931km",
                "fsoftSeat": "651.5",
                "ssoftSeat": "407.5",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "407.5",
                "swz": "1286.5",
                "tdz": "-",
                "gjrw": "-",
                "stay": "3"
            },
            {
                "train_id": "12",
                "station_name": "涿州东",
                "arrived_time": "15:59",
                "leave_time": "16:02",
                "mileage": "1150km",
                "fsoftSeat": "785.5",
                "ssoftSeat": "491.5",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "491.5",
                "swz": "1551.5",
                "tdz": "-",
                "gjrw": "-",
                "stay": "3"
            },
            {
                "train_id": "13",
                "station_name": "北京西",
                "arrived_time": "16:27",
                "leave_time": "16:27",
                "mileage": "1212km",
                "fsoftSeat": "822.5",
                "ssoftSeat": "513.5",
                "hardSead": "-",
                "softSeat": "-",
                "hardSleep": "-",
                "softSleep": "-",
                "wuzuo": "513.5",
                "swz": "1623.5",
                "tdz": "-",
                "gjrw": "-",
                "stay": "-"
            }
        ]
    },
    "error_code": 0
}

服务级错误码参照(error_code):

  错误码 说明

系统级错误码参照:

  错误码 说明 旧版本(resultcode)

错误码格式说明(示例:200201):

  2 002 01
  服务级错误(1为系统级错误) 服务模块代码(即数据ID) 具体错误代码

完整教学代码示例:

  语言 标题 提供者 时间

常见问题:

  内容 详细
  常见问题: http://www.juhe.cn/qa/index/1547812532

联系我们

  内容 详细
  接口测试: API测试工具
  技术支持: info@juhe.cn
  联系电话: 400-882-7715
  在线客服QQ: 800076065

现在注册,百款接口免费测试

免费注册