aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2017-07-13 15:37:02 +0200
committerMartin Polden <mpolden@mpolden.no>2017-07-13 15:38:27 +0200
commit79c2b01fd5ff29aac09fcff9f15a49b91f1d0c2b (patch)
tree9a1dc3a3936f5b56b221145e320ba6f0dc02461c
parent1b0b9665f72a7f08ece68225432c4a5487f53cd6 (diff)
Update readme
-rw-r--r--README.md59
1 files changed, 47 insertions, 12 deletions
diff --git a/README.md b/README.md
index c9da72f..af45002 100644
--- a/README.md
+++ b/README.md
@@ -43,17 +43,35 @@ Help Options:
}
```
-## API usage
+## API
-The route `/api/v1/busstops` returns a list of all known bus stops.
+### `/`
+
+Lists all available API routes.
+
+Example:
+
+```
+$ curl https://atbapi.tar.io | jq .
+{
+ "urls": [
+ "https://atbapi.tar.io/api/v1/busstops",
+ "https://atbapi.tar.io/api/v1/departures"
+ ]
+}
+```
+
+
+### `/api/v1/busstops`
+
+Lists all known bus stops.
Example:
```
-$ curl 'https://atbapi.tar.io/api/v1/busstops' | jq .
+$ curl https://atbapi.tar.io/api/v1/busstops | jq .
{
"stops": [
- ...
{
"stopId": 100633,
"nodeId": 16011376,
@@ -68,13 +86,14 @@ $ curl 'https://atbapi.tar.io/api/v1/busstops' | jq .
}
```
-The route `/api/v1/busstops/<nodeID>` returns information about a given bus
-stop, identified by a node ID.
+### `/api/v1/busstops/{node-id}`
+
+Information about the given bus stop, identified by a node ID.
Example:
```
-$ curl 'https://atbapi.tar.io/api/v1/busstops/16011376' | jq .
+$ curl https://atbapi.tar.io/api/v1/busstops/16011376 | jq .
{
"stopId": 100633,
"nodeId": 16011376,
@@ -89,7 +108,7 @@ $ curl 'https://atbapi.tar.io/api/v1/busstops/16011376' | jq .
As [GeoJSON](http://geojson.org/):
```
-$ curl 'https://atbapi.tar.io/api/v1/busstops/16011376?geojson' | jq .
+$ curl https://atbapi.tar.io/api/v1/busstops/16011376?geojson | jq .
{
"type": "Feature",
"geometry": {
@@ -114,17 +133,33 @@ $ curl 'https://atbapi.tar.io/api/v1/busstops/16011376?geojson' | jq .
}
```
-The route `/api/v1/departures/<nodeID>` returns a list of departures for a given bus
-stop, identified by a node ID.
+### `/api/v1/departures`
+
+Lists departure URLs for all known bus stops.
Example:
```
-$ curl 'https://atbapi.tar.io/api/v1/departures/16011376' | jq .
+$ curl -s https://atbapi.tar.io/api/v1/departures | jq .
+{
+ "urls": [
+ "https://atbapi.tar.io/api/v1/departures/15057011",
+ ...
+ ]
+}
+```
+
+### `/api/v1/departures/{node-id}`
+
+Lists all departures for the given bus stop, identified by a node ID.
+
+Example:
+
+```
+$ curl https://atbapi.tar.io/api/v1/departures/16011376 | jq .
{
"isGoingTowardsCentrum": true,
"departures": [
- ...
{
"line": "36",
"registeredDepartureTime": "2015-02-26T22:55:00.000",