diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 138 |
1 files changed, 6 insertions, 132 deletions
@@ -3,7 +3,7 @@ ![Build Status](https://github.com/mpolden/atb/workflows/ci/badge.svg) A minimal API for bus data in Trondheim, Norway. This API proxies requests to -AtB/Entur APIs and converts the responses into a sane JSON format. +Entur APIs and converts the responses into a sane JSON format. Responses from the proxied APIs are cached. By default bus stops will be cached for 1 week and departures for 1 minute. @@ -11,13 +11,11 @@ for 1 week and departures for 1 minute. As of mid-August 2021 the SOAP-based AtB API no longer returns any departure data. According to [this blog post on open data](https://beta.atb.no/blogg/apne-data-og-atb) it appears the preferred API -is now [Entur](https://developer.entur.org/). +is now [Entur](https://developer.entur.org/). The `/api/v1/` paths have +therefore been removed. -Version 1 of this API will remain implemented for now, but likely won't return -any usable data. - -Version 2 has been implemented and proxies requests to Entur. These are the -changes in version 2: +Version 2 has been implemented and proxies requests to Entur instead. These are +the changes in version 2: * There is no version 2 variant of `/api/v1/busstops`. Use https://stoppested.entur.org/ to find valid stop IDs. @@ -27,7 +25,7 @@ changes in version 2: * The `registeredDepartureTime` field may be omitted. * The `isGoingTowardsCentrum` field has moved to the departure object. -Both version 1 and 2 of this API aims to be compatible with +This API aims to be compatible with [BusBuddy](https://github.com/norrs/busbuddy) (which appears to be defunct). ## Usage @@ -35,8 +33,6 @@ Both version 1 and 2 of this API aims to be compatible with ``` $ atb -h Usage of atb: - -c string - Path to config file (default "config.json") -d string Departure cache duration (default "1m") -l string @@ -46,15 +42,6 @@ Usage of atb: -x Allow requests from other domains ``` -## Example config - -``` -{ - "Username": "username", - "Password": "password" -} -``` - ## API ### `/` @@ -67,8 +54,6 @@ Example: $ curl https://mpolden.no/atb/ | jq . { "urls": [ - "https://mpolden.no/atb/v1/busstops", - "https://mpolden.no/atb/v1/departures", "https://mpolden.no/atb/v2/departures" ] } @@ -105,114 +90,3 @@ $ curl 'https://mpolden.no/atb/v2/departures/41613?direction=inbound' | jq . ] } ``` - - -### `/api/v1/busstops` - -Lists all known bus stops. - -Example: - -``` -$ curl https://mpolden.no/atb/v1/busstops | jq . -{ - "stops": [ - { - "stopId": 100633, - "nodeId": 16011376, - "description": "Prof. Brochs gt", - "longitude": 10.398125177823237, - "latitude": 63.4155348940887, - "mobileCode": "16011376 (Prof.)", - "mobileName": "Prof. (16011376)" - }, - ... - ] -} -``` - -### `/api/v1/busstops/{node-id}` - -Information about the given bus stop, identified by a node ID. - -Example: - -``` -$ curl https://mpolden.no/atb/v1/busstops/16011376 | jq . -{ - "stopId": 100633, - "nodeId": 16011376, - "description": "Prof. Brochs gt", - "longitude": 10.398126, - "latitude": 63.415535, - "mobileCode": "16011376 (Prof.)", - "mobileName": "Prof. (16011376)" -} -``` - -As [GeoJSON](http://geojson.org/): - -``` -$ curl https://mpolden.no/atb/v1/busstops/16011376?geojson | jq . -{ - "type": "Feature", - "geometry": { - "type": "Point", - "coordinates": [ - 10.398126, - 63.415535 - ] - }, - "properties": { - "busstop": { - "stopId": 100633, - "nodeId": 16011376, - "description": "Prof. Brochs gt", - "longitude": 10.398126, - "latitude": 63.415535, - "mobileCode": "16011376 (Prof.)", - "mobileName": "Prof. (16011376)" - }, - "name": "Prof. Brochs gt" - } -} -``` - -### `/api/v1/departures` - -Lists departure URLs for all known bus stops. - -Example: - -``` -$ curl -s https://mpolden.no/atb/v1/departures | jq . -{ - "urls": [ - "https://mpolden.no/atb/v1/departures/15057011", - ... - ] -} -``` - -### `/api/v1/departures/{node-id}` - -Lists all departures for the given bus stop, identified by a node ID. - -Example: - -``` -$ curl https://mpolden.no/atb/v1/departures/16011376 | jq . -{ - "isGoingTowardsCentrum": true, - "departures": [ - { - "line": "36", - "registeredDepartureTime": "2015-02-26T22:55:00.000", - "scheduledDepartureTime": "2015-02-26T22:54:00.000", - "destination": "Munkegata M4", - "isRealtimeData": true - }, - ... - ] -} -``` |