DOCS

按车次读取当前完整时刻表

返回该车次的时刻表,包括经停站、当前站车次、检票口信息和参考车型。

返回 API 列表
get/api/v1/timetable/train/{trainCode}/current
可匿名访问api.timetable.train.current.read

COST

扣费规则

每次请求按固定额度扣费,不随返回条数变化。

固定 1 点额度/次

实际扣费以响应头 x-api-cost 为准。

请求说明

参数

路径参数

trainCodestring 必填

要查询的车次号,例如 D2212。

示例:D2212

响应说明

状态码与响应格式

200

当前日期下的完整车次时刻表。

响应头

x-api-remainx-api-cost
application/jsonobject

响应结构

{
    "type": "object",
    "required": [
        "ok",
        "data",
        "error"
    ],
    "properties": {
        "ok": {
            "type": "boolean",
            "required": true
        },
        "data": {
            "type": "object",
            "required": true,
            "shape": {
                "type": "object",
                "required": [
                    "updatedAt",
                    "requestTrainCode",
                    "trainCode",
                    "internalCode",
                    "allCodes",
                    "bureauCode",
                    "bureauName",
                    "trainDepartment",
                    "passengerDepartment",
                    "referenceModels",
                    "startStation",
                    "endStation",
                    "startAt",
                    "endAt",
                    "inferredCirculation",
                    "stops"
                ],
                "properties": {
                    "updatedAt": {
                        "type": "integer | null",
                        "required": true
                    },
                    "requestTrainCode": {
                        "type": "string",
                        "required": true
                    },
                    "trainCode": {
                        "type": "string",
                        "required": true
                    },
                    "internalCode": {
                        "type": "string",
                        "required": true
                    },
                    "allCodes": {
                        "type": "array<string>",
                        "required": true,
                        "shape": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    },
                    "bureauCode": {
                        "type": "string",
                        "required": true
                    },
                    "bureauName": {
                        "type": "string",
                        "required": true
                    },
                    "trainDepartment": {
                        "type": "string",
                        "required": true
                    },
                    "passengerDepartment": {
                        "type": "string",
                        "required": true
                    },
                    "referenceModels": {
                        "type": "array<object>",
                        "required": true,
                        "shape": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "required": [
                                    "model",
                                    "weightedShare"
                                ],
                                "properties": {
                                    "model": {
                                        "type": "string",
                                        "required": true
                                    },
                                    "weightedShare": {
                                        "type": "number",
                                        "required": true
                                    }
                                }
                            }
                        }
                    },
                    "startStation": {
                        "type": "string",
                        "required": true
                    },
                    "endStation": {
                        "type": "string",
                        "required": true
                    },
                    "startAt": {
                        "type": "integer",
                        "required": true
                    },
                    "endAt": {
                        "type": "integer",
                        "required": true
                    },
                    "inferredCirculation": {
                        "type": "object",
                        "required": true,
                        "shape": {
                            "oneOf": [
                                {
                                    "type": "object",
                                    "required": [
                                        "routeId",
                                        "windowStart",
                                        "windowEnd",
                                        "threshold",
                                        "lowestLinkWeight",
                                        "lowestLinkSupportCount",
                                        "containsLoopBreak",
                                        "nodes"
                                    ],
                                    "properties": {
                                        "routeId": {
                                            "type": "string",
                                            "required": true
                                        },
                                        "windowStart": {
                                            "type": "integer",
                                            "required": true
                                        },
                                        "windowEnd": {
                                            "type": "integer",
                                            "required": true
                                        },
                                        "threshold": {
                                            "type": "number",
                                            "required": true
                                        },
                                        "lowestLinkWeight": {
                                            "type": "number | null",
                                            "required": true
                                        },
                                        "lowestLinkSupportCount": {
                                            "type": "integer | null",
                                            "required": true
                                        },
                                        "containsLoopBreak": {
                                            "type": "boolean",
                                            "required": true
                                        },
                                        "nodes": {
                                            "type": "array<object>",
                                            "required": true,
                                            "shape": {
                                                "type": "array",
                                                "items": {
                                                    "type": "object",
                                                    "required": [
                                                        "internalCode",
                                                        "allCodes",
                                                        "startStation",
                                                        "endStation",
                                                        "startAt",
                                                        "endAt",
                                                        "incomingWeight",
                                                        "incomingSupportCount",
                                                        "outgoingWeight",
                                                        "outgoingSupportCount"
                                                    ],
                                                    "properties": {
                                                        "internalCode": {
                                                            "type": "string | null",
                                                            "required": true
                                                        },
                                                        "allCodes": {
                                                            "type": "array<string>",
                                                            "required": true,
                                                            "shape": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "string"
                                                                }
                                                            }
                                                        },
                                                        "startStation": {
                                                            "type": "string",
                                                            "required": true
                                                        },
                                                        "endStation": {
                                                            "type": "string",
                                                            "required": true
                                                        },
                                                        "startAt": {
                                                            "type": "integer | null",
                                                            "required": true
                                                        },
                                                        "endAt": {
                                                            "type": "integer | null",
                                                            "required": true
                                                        },
                                                        "incomingWeight": {
                                                            "type": "number | null",
                                                            "required": true
                                                        },
                                                        "incomingSupportCount": {
                                                            "type": "integer | null",
                                                            "required": true
                                                        },
                                                        "outgoingWeight": {
                                                            "type": "number | null",
                                                            "required": true
                                                        },
                                                        "outgoingSupportCount": {
                                                            "type": "integer | null",
                                                            "required": true
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            ]
                        }
                    },
                    "stops": {
                        "type": "array<object>",
                        "required": true,
                        "shape": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "required": [
                                    "stationNo",
                                    "stationName",
                                    "arriveAt",
                                    "departAt",
                                    "stationTrainCode",
                                    "wicket",
                                    "isStart",
                                    "isEnd"
                                ],
                                "properties": {
                                    "stationNo": {
                                        "type": "integer",
                                        "required": true
                                    },
                                    "stationName": {
                                        "type": "string",
                                        "required": true
                                    },
                                    "arriveAt": {
                                        "type": "integer | null",
                                        "required": true
                                    },
                                    "departAt": {
                                        "type": "integer | null",
                                        "required": true
                                    },
                                    "stationTrainCode": {
                                        "type": "string | null",
                                        "required": true
                                    },
                                    "wicket": {
                                        "type": "string | null",
                                        "required": true
                                    },
                                    "isStart": {
                                        "type": "boolean",
                                        "required": true
                                    },
                                    "isEnd": {
                                        "type": "boolean",
                                        "required": true
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "error": {
            "type": "string",
            "required": true
        }
    }
}

示例响应

{
    "ok": true,
    "data": {
        "updatedAt": 1776602294,
        "requestTrainCode": "G512",
        "trainCode": "G512",
        "internalCode": "390000G5120C",
        "allCodes": [
            "G512"
        ],
        "bureauCode": "N",
        "bureauName": "武汉局集团",
        "trainDepartment": "郑州动车段",
        "passengerDepartment": "郑州客运段",
        "referenceModels": [
            {
                "model": "CR400BF-A",
                "weightedShare": 1
            }
        ],
        "startStation": "汉口",
        "endStation": "北京西",
        "startAt": 1777698540,
        "endAt": 1777717260,
        "inferredCirculation": {
            "routeId": "circulation_a0ee45fa",
            "windowStart": 1776528000,
            "windowEnd": 1777737599,
            "threshold": 0.8,
            "lowestLinkWeight": 1,
            "lowestLinkSupportCount": 6,
            "containsLoopBreak": false,
            "nodes": [
                {
                    "internalCode": "38000G208500",
                    "allCodes": [
                        "G2085"
                    ],
                    "startStation": "郑州东",
                    "endStation": "汉口",
                    "startAt": 1777687260,
                    "endAt": 1777697340,
                    "incomingWeight": null,
                    "incomingSupportCount": null,
                    "outgoingWeight": 1,
                    "outgoingSupportCount": 6
                },
                {
                    "internalCode": "390000G5120C",
                    "allCodes": [
                        "G512"
                    ],
                    "startStation": "汉口",
                    "endStation": "北京西",
                    "startAt": 1777698540,
                    "endAt": 1777717260,
                    "incomingWeight": 1,
                    "incomingSupportCount": 6,
                    "outgoingWeight": 1,
                    "outgoingSupportCount": 6
                },
                {
                    "internalCode": "240000G34910",
                    "allCodes": [
                        "G349"
                    ],
                    "startStation": "北京西",
                    "endStation": "武汉",
                    "startAt": 1777719300,
                    "endAt": 1777734180,
                    "incomingWeight": 1,
                    "incomingSupportCount": 6,
                    "outgoingWeight": null,
                    "outgoingSupportCount": null
                }
            ]
        },
        "stops": [
            {
                "stationNo": 1,
                "stationName": "汉口",
                "arriveAt": 1777698540,
                "departAt": 1777698540,
                "stationTrainCode": "G512",
                "wicket": "二楼11B检票口",
                "isStart": true,
                "isEnd": false
            },
            {
                "stationNo": 2,
                "stationName": "许昌东",
                "arriveAt": 1777704240,
                "departAt": 1777704960,
                "stationTrainCode": "G512",
                "wicket": "一层检票口",
                "isStart": false,
                "isEnd": false
            },
            {
                "stationNo": 3,
                "stationName": "郑州东",
                "arriveAt": 1777706340,
                "departAt": 1777706520,
                "stationTrainCode": "G512",
                "wicket": "6A_7A,6B_7B",
                "isStart": false,
                "isEnd": false
            },
            {
                "stationNo": 4,
                "stationName": "高邑西",
                "arriveAt": 1777711320,
                "departAt": 1777711440,
                "stationTrainCode": "G512",
                "wicket": "检票口1",
                "isStart": false,
                "isEnd": false
            },
            {
                "stationNo": 5,
                "stationName": "石家庄",
                "arriveAt": 1777712340,
                "departAt": 1777712520,
                "stationTrainCode": "G512",
                "wicket": "14B15B",
                "isStart": false,
                "isEnd": false
            },
            {
                "stationNo": 6,
                "stationName": "保定东",
                "arriveAt": 1777714620,
                "departAt": 1777714740,
                "stationTrainCode": "G512",
                "wicket": "进站检票口,进站检票口2",
                "isStart": false,
                "isEnd": false
            },
            {
                "stationNo": 7,
                "stationName": "北京西",
                "arriveAt": 1777717260,
                "departAt": 1777717260,
                "stationTrainCode": "G512",
                "wicket": "",
                "isStart": false,
                "isEnd": true
            }
        ]
    },
    "error": ""
}
400

Invalid path parameters.

响应头

x-api-remainx-api-cost
application/jsonobject

响应结构

{
    "type": "object",
    "required": [
        "ok",
        "data",
        "error"
    ],
    "properties": {
        "ok": {
            "type": "boolean",
            "required": true
        },
        "data": {
            "type": "string",
            "required": true
        },
        "error": {
            "type": "string",
            "required": true
        }
    }
}

示例响应

{
    "ok": false,
    "data": "trainCode 不能为空。",
    "error": "invalid_param"
}
404

当前时刻表暂不可用。

响应头

x-api-remainx-api-cost
application/jsonobject

响应结构

{
    "type": "object",
    "required": [
        "ok",
        "data",
        "error"
    ],
    "properties": {
        "ok": {
            "type": "boolean",
            "required": true
        },
        "data": {
            "type": "string",
            "required": true
        },
        "error": {
            "type": "string",
            "required": true
        }
    }
}

示例响应

{
    "ok": false,
    "data": "当前暂无时刻表。",
    "error": "not_found"
}