稳定、快速、的 API 接口服务
今日调用0次,累计调用79次
查询火车票数据
接口地址: https://wyq.wqwlkj.cn/api/train_search
返回格式: JSON
请求方式: GET/POST
请求示例: https://wyq.wqwlkj.cn/api/train_search
请求参数说明:
| 名称 | 必填 | 类型 | 说明 |
|---|---|---|---|
| departure | 是 | string | 出发点 |
| arrival | 是 | string | 目的地 |
| type | 否 | int | 查询类型。1 查询高铁(G开头),2 查询动车(D开头),3 查询全部相关。默认3 |
| date | 否 | string | 查询出发的日期,默认是查询当天 |
| apiKey | 是 | string | 独立的apikey |
返回参数说明:
| 名称 | 类型 | 说明 |
|---|---|---|
| code | int | 1成功,其他失败 |
| go | string | 出发点 |
| to | string | 目的地 |
| date | string | 查询出发的日期 |
| list | string | 数据信息 |
| list['TrainNumber'] | string | 列车车次 |
| list['TotalTime'] | string | 总时长 |
| list['TrainType'] | string | 列车类型 |
| list['Depart'] | string | 上车站点 |
| list['Dest'] | string | 下车站点 |
| list['DepartTime'] | string | 发车时间 |
| list['DestTime'] | string | 下车时间 |
| list['prices'] | string | 各个类型的价格 |
| error | string | 查询失败的原因 |
返回示例:
{
"code": 1,
"go": "上海",
"to": "南宁",
"date": "2024-01-16",
"list": [
{
"TrainNumber": "G1505",
"TotalTime": "11小时43分钟",
"TrainType": "高铁",
"Depart": "上海虹桥",
"Dest": "南宁东",
"DepartTime": "07:53",
"DestTime": "19:36",
"prices": [
{
"name": "一等座",
"status": "有",
"price": 1314.5
},
{
"name": "二等座",
"status": "有",
"price": 800
},
{
"name": "商务座",
"status": "票量紧张",
"price": 2475
}
]
},
{
"TrainNumber": "G1501",
"TotalTime": "11小时19分钟",
"TrainType": "高铁",
"Depart": "上海虹桥",
"Dest": "南宁东",
"DepartTime": "10:03",
"DestTime": "21:22",
"prices": [
{
"name": "一等座",
"status": "有",
"price": 1300.5
},
{
"name": "二等座",
"status": "有",
"price": 791
},
{
"name": "商务座",
"status": "票量紧张",
"price": 2451
}
]
}
]
}
请求参数设置:
| 参数名称 | 参数值 |
|---|---|
{
"code": 1,
"go": "上海",
"to": "南宁",
"date": "2024-01-16",
"list": [
{
"TrainNumber": "G1505",
"TotalTime": "11小时43分钟",
"TrainType": "高铁",
"Depart": "上海虹桥",
"Dest": "南宁东",
"DepartTime": "07:53",
"DestTime": "19:36",
"prices": [
{
"name": "一等座",
"status": "有",
"price": 1314.5
},
{
"name": "二等座",
"status": "有",
"price": 800
},
{
"name": "商务座",
"status": "票量紧张",
"price": 2475
}
]
},
{
"TrainNumber": "G1501",
"TotalTime": "11小时19分钟",
"TrainType": "高铁",
"Depart": "上海虹桥",
"Dest": "南宁东",
"DepartTime": "10:03",
"DestTime": "21:22",
"prices": [
{
"name": "一等座",
"status": "有",
"price": 1300.5
},
{
"name": "二等座",
"status": "有",
"price": 791
},
{
"name": "商务座",
"status": "票量紧张",
"price": 2451
}
]
}
]
}
错误码格式说明:
| 名称 | 类型 | 说明 |
|---|
代码示例:
自行写