Backend Service for the https://map.railway-stations.org website and the Mobile Apps for Android and iOS of the Bahnhofsfotos opendata Project.
This API is hosted at https://api.railway-stations.org.
To build the project, you need Java 21.
Run on Unix like systems:
./gradlew :service:bootJar
Run on Windows:
./gradlew.bat :service:bootJar
Build docker image:
docker build . -t railwaystations/rsapi:latest
After importing this project for the first time, you might need to specify the folder service/build/openapi
as
source
root folder.
The API uses /var/rsapi
as working directory. This can be changed in the application.yaml
or via Docker volume, see
below.
The following subdirectories are being used:
-
photos
{country}
: photos for the country identified by the country code
-
inbox
: all uploads are collected here-
toprocess
: uploaded photos are sent to VsionAI for image processing -
processed
: processed photos from VsionAI -
done
: imported (unprocessed) photos -
rejected
: rejected photos
-
The API can be started via IntelliJ. A local Maria DB can be started via docker compose up -d
locally.
The API is then available via http://localhost:8080
.
For local testing and debugging you can enter mariadb via CLI:
docker exec -it mariadb mysql -ursapi -prsapi rsapi --default-character-set=utf8mb4
Point your browser to http://localhost:8080/photoStationsByCountry/de
, where the last path segment is the country
selector and can be "de", "ch", "fi", "uk", ...
With the following query parameter:
-
hasPhoto
: boolean, indicates if only railwaystations with or without a photo should be selected -
isActive
: select only railwaystations which are active
A more detailed API documentation can be found in the OpenAPI file or online at developer.deutschebahn.com.
-
all supported countries: https://api.railway-stations.org/countries
-
all german railwaystations: https://api.railway-stations.org/photoStationsByCountry/de
-
german railwaystations without photo: https://api.railway-stations.org/photoStationsByCountry/de?hasPhoto=false
-
one railwaystation with all its photos: https://api.railway-stations.org/photoStationById/de/1973
-
austrian trainsations from photographer @pokipsie: https://api.railway-stations.org/photoStationsByPhotographer/@pokipsie?country=ch
-
all photographers with count of photos: https://api.railway-stations.org/photographers
-
german photographers: https://api.railway-stations.org/photographers?country=de
-
statistic per country (de): https://api.railway-stations.org/stats?country=de
Some historic milestones of the app.
Project founded on the 3rd DB-Hackathon as "Deutschlands Bahnhöfe".
Railway-station data of germany where imported into an Elasticsearch DB. Photos could be sent via eMail or a Dropbox folder. Photos were manually imported into a Drupal CMS.
Start as a Dropwizard service to provide the railway-station data from the Elasticsearch database as GPX files: https://github.com/RailwayStations/RSAPI/commit/f8dcefd950e776266b4463d0d414599a23f17d94
Add Json and text endpoints of the railway-station data: https://github.com/RailwayStations/RSAPI/commit/f102eb475e8bc29751cfb85e2773376c088817d2
The app serves the railway-station data as Json for the Android app.
Photos could be uploaded via API Endpoint: https://github.com/RailwayStations/RSAPI/commit/a6171ce5a420fce11b6975a41397ab92e3cb266a
Replacement of the Drupal CMS. Mass import of photos from filesystem via Slack command: https://github.com/RailwayStations/RSAPI/commit/d7b2baf48a39911b1913706b8e0b9d6f6dcf958a
Migration from Elasticsearch to Mariadb: https://github.com/RailwayStations/RSAPI/commit/12519f916ba31447b002b63d24e01a31c3821207
Account registration via API Endpoint.
Admin Endpoints to import or reject uploaded photos: https://github.com/RailwayStations/RSAPI/commit/d0fea732d24b0362f10f0992e63e301c42a0d04c
Migration from Dropwizard to Springboot: https://github.com/RailwayStations/RSAPI/commit/a327d815dec4c31965ebd4d4e8a805ea8fa7dfb0
Included Maven to Gradle migration.
Refactor towards hexagonal architecture: https://github.com/RailwayStations/RSAPI/commit/3e01a36c1b9e3f9bba4e60ec648211ba07c1ac09
Added OpenApi generation: https://github.com/RailwayStations/RSAPI/commit/4fe7b29495ffa4eed4422102815ed312b7e5c73d
Spring authorization server integration: https://github.com/RailwayStations/RSAPI/commit/24e1ffdc28db75f0cea5db3c26e915957321fba4
Apps and webclient can now authorize users via OAuth2.
Java to Kotlin migration: https://github.com/RailwayStations/RSAPI/commit/a55a5ab02a3dd47f2bb14d3cdce5d55a0ef361f9
Liquibase to Flyway migration: https://github.com/RailwayStations/RSAPI/commit/c713f70c564c4d764614c39cdf2815f98abfa917
Split into multi modules: https://github.com/RailwayStations/RSAPI/commit/7c94f5464fe3fe21cba3eefe58a73e98c5d1ab68