API References - CPNV-ES-BI1-RIA2-ETL-INTERNAL-SOURCE/DATA-GENERATOR-ETL GitHub Wiki

Stationboard

Version: 1.0.3

Description

API documentation for retrieving station timetables, supporting both JSON and PDF formats.

Server

  • URL: http://localhost:8080
  • Description: Local server for the Stationboard API.

Endpoints

GET /api/v1/stationboard/{country}/{station}

Summary

Retrieve timetables for a specified country and station.

Description

Returns connection schedules for a specified country and city at a given date. The response format depends on the Accept header:

  • application/json: Returns detailed data in JSON format.
  • application/pdf: Returns a PDF document.

Parameters

Name In Type Required Description Example
country path string Yes Code iso of the country (e.g., "CH"). CH
station path string Yes Name or ID of the station (e.g., Yverdon-les-Bains or 8504200). zurich
date query string Yes Date in the format MM/DD/YYYY. 12/12/2024

Headers

Name Required Description Values
Accept Yes Response format. application/json, application/pdf

Responses

200 OK
  • Description: Successful response containing timetable information.
  • Content:
    • application/json
      • Schema:
        {
          "stop": {
            "id": "string",
            "name": "string",
            "type": "string",
            "x": "string",
            "y": "string",
            "lon": "number",
            "lat": "number"
          },
          "connections": [
            {
              "time": "string",
              "type": "string",
              "line": "string",
              "operator": "string",
              "color": "string",
              "type_name": "string",
              "track": "string",
              "terminal": {
                "id": "string",
                "name": "string",
                "lon": "number",
                "lat": "number"
              },
              "subsequent_stops": [
                {
                  "id": "string",
                  "name": "string",
                  "lon": "number",
                  "lat": "number",
                  "arr": "string",
                  "dep": "string"
                }
              ]
            }
          ]
        }
        
      • Example:
        {
          "stop": {
            "id": "8503000",
            "name": "Zurich HB",
            "type": "train",
            "x": "2684695",
            "y": "1247854",
            "lon": 8.540192,
            "lat": 47.378177
          },
          "connections": [
            {
              "time": "2024-12-01T12:30:00",
              "type": "express_train",
              "line": "IC 708",
              "operator": "SBB",
              "color": "#FF0000",
              "type_name": "InterCity",
              "track": "7A",
              "terminal": {
                "id": "8507000",
                "name": "Geneva",
                "lon": 6.142297,
                "lat": 46.210484
              },
              "subsequent_stops": [
                {
                  "id": "8504000",
                  "name": "Bern",
                  "lon": 7.443067,
                  "lat": 46.948094,
                  "arr": "2024-12-01T13:45:00",
                  "dep": "2024-12-01T13:50:00"
                }
              ]
            }
          ]
        }
        
    • application/pdf
      • Schema:
        • Type: string
        • Format: binary
      • Description: Binary PDF content containing the requested station schedules.
400 Bad Request
  • Description: Invalid request (missing or incorrect parameter).
404 Not Found
  • Description: Resource not found.
406 Not Acceptable
  • Description: Response format not accepted. Use application/json or application/pdf.
500 Internal Server Error
  • Description: Server encountered an error.