Read-only mirror of https://github.com/openTdataCH/api-explorer — SBB. Issues & pull requests at the source.
  • TypeScript 92.7%
  • HTML 7%
  • SCSS 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
MarklinH0-39 5bf6bc0b6b
Merge pull request #22 from openTdataCH/MarklinH0-39-patch-1
Add 'SZU' to supported EVUs in TFS
2026-12-04 08:14:49 +01:00
.github/workflows Removed local branch 2026-04-15 16:17:48 +02:00
public Bump version to 2.0.2 2026-12-03 10:43:39 +01:00
src Updates footer text date 2026-07-06 18:15:21 +02:00
.editorconfig From angular bootstrap 2026-04-09 14:40:32 +02:00
.gitignore Updates .gitignore 2026-04-10 13:47:58 +02:00
.prettierrc From angular bootstrap 2026-04-09 14:40:32 +02:00
angular.json Increase budget 2026-04-15 12:03:38 +02:00
LICENSE.txt Adds licence file 2025-08-18 18:10:02 +02:00
package-lock.json Fresh npm install 2026-04-15 12:08:34 +02:00
package.json Adds rest of packages 2026-04-10 13:46:16 +02:00
README.md Updates README 2026-04-20 23:23:04 +02:00
tsconfig.app.json Suppress errors 2026-04-15 16:21:54 +02:00
tsconfig.json From angular bootstrap 2026-04-09 14:40:32 +02:00
tsconfig.spec.json From angular bootstrap 2026-04-09 14:40:32 +02:00

opentransportdata.swiss API-Explorer

This repo allows to browse the OpenAPI specs for opentransportdata.swiss. It publishes a simple site (via GitHub Pages) where each API is rendered with Swagger UI so you can read endpoints, schemas, and pre-authorized try requests directly from the browser.

URL: https://opentdatach.github.io/api-explorer/

Local Development

$ npm install

# duplicate local API credential file
$ cp ./src/app/config/api-tokens.ts ./src/app/config/api-tokens.local.ts

# edit api-tokens.local.ts
# fill with tokens obtained from https://api-manager.opentransportdata.swiss/

# develop on localhost
$ ng serve

# open http://localhost:4200

Adds a new API

Placeholders

const handlerLoaders: Record<PlaceHolderKey, () => Promise<PlaceholderModule>> = {
  today: () => import('./placeholders/today'),
  isoTimestamp: () => import('./placeholders/iso-timestamp'),
  RESPONSE_XML_LIR1: () => import('./placeholders/ojp-lir1'),
  RESPONSE_XML_TR1: () => import('./placeholders/ojp-tr1'),
  REQUEST_XML_FR1: () => import('./placeholders/ojp-fr1'),
  RESPONSE_XML_FR2: () => import('./placeholders/ojp-fr2'),
  REQUEST_XML_TRR1: () => import('./placeholders/ojp-trr1'),
};
  • example of placeholder usage
<OJPTripInfoRequest>
    <siri:RequestTimestamp>{{isoTimestamp}}</siri:RequestTimestamp>
    <siri:MessageIdentifier>TIR-1a</siri:MessageIdentifier>
    <JourneyRef>ch:1:sjyid:100001:18355-001</JourneyRef>
    <OperatingDayRef>{{today}}</OperatingDayRef>
</OJPTripInfoRequest>

{{today}} string is replaced with content resolved in ./src/app/detail/placeholders/today.ts

    summary: "11. Trip Refine Request"
    description: "TRR request for the first trip of Bern - Zurich TR request occuring next day after 10AM. The TR response XML is pre-fetched using ojp-sdk"
    value: | 
        {{REQUEST_XML_TRR1}}

{{REQUEST_XML_TRR1}} string is replaced with ojp-sdk TripRequest parsed in ./src/app/detail/placeholders/ojp-trr1.ts

Deployment

A GitHub Actions workflow (under .github/workflows/deploy-pages.yml) builds the site and publishes it to GitHub Pages on push to the default branch

License

The project is released under a MIT license.

Copyright (c) 2025 - 2026 Open Data Platform Mobility Switzerland - opentransportdata.swiss.