Distance-ten usage
This service handles distances between railway stations, measured along the track.
It has an open API for looking up distances, and an internal API for data maintenance.
Background
Changes in distance data are quite rare. They may happen when the tracks are modified, when a station is taken out of service or if a new station is introduced.
The API for doing data maintenance is still incomplete. The procedure is currently based on running SQL commands in the distance-ten database, and requires some familiarity with the database structure. Details can be found in this file in the source code repo:
.../distance-ten/src/master/README.md
Authorization
The maintenance endpoints require authorization with a bearer token based on the distance-ten clientId and -secret.
Use the kubernetes secret distance-ten-client-credentials
.
Endpoint examples
Look up the distance between a pair of stopPlaces:
curl \
-X GET \
-H "ET-Client-Name: somecompany - someapp" \
https://api.entur.io/distance-ten/NSR:StopPlace:337/NSR:StopPlace:1
Verify that the current data set is ok:
curl \
-X GET \
-H "ET-Client-Name: somecompany - someapp" \
https://api.entur.io/distance-ten/admin/verify/CURRENT/1
Verify that data set 3 is ok when compared to data set 2:
curl \
-X GET \
-H "ET-Client-Name: somecompany - someapp" \
https://api.entur.io/distance-ten/admin/verify/3/2
Refresh the cache:
curl \
-X POST \
-H "Authorization: Bearer $token" \
-H "Content-Length: 0" \
https://api.entur.io/distance-ten/admin/flush
Swagger api docs:
curl https://api.entur.io/distance-ten/api-docs/swagger.json
curl https://api.entur.io/distance-ten/api-docs/swagger.yaml