Web Service to query the Dublin bus GPS sample data. Part of tb.lx backend code challenge.
- docker
- docker-compose
- sbt
The sample data resides in ElasticSearch.
Launch Elastic Stack (elasticsearch, logstash) with docker-compose up
.
It might take a few minutes to start the stack and it will also import the sample Dublin Bus data in sample-data/siri.20121125.csv
to ElasticSearch.
Stop and erase data related to Elastic Stack with docker-compose down -v
http4s was the Web Server chosen to serve the requests. It listens on port 8080
.
Type sbt run
in a terminal while in the project's root directory to start it.
API is defined in src/main/resources/api-definition.raml
, load it into your favorite REST client.
POST /operators/list
JSON Body:
{
"startTime": "2012-11-25T06:00:00",
"endTime": "2012-11-25T08:00:00"
}
POST /vehicles/list
JSON Body:
{
"startTime": "2012-11-25T03:00:00",
"endTime": "2012-11-25T07:00:00",
"operator": "SL"
}
Same endpoint as above. Filter in JSON accepts optional boolean filter:
{
"startTime": "2012-11-25T00:00:00",
"endTime": "2012-11-25T07:00:00",
"operator": "CF",
"atStop": true
}
POST /vehicles/trace
{
"startTime": "2012-11-25T00:00:00",
"endTime": "2012-11-25T07:00:00",
"vehicleID": 33234
}