Sample Rest API about realtime statistic from the last 60 seconds
mvn clean install
mvn spring-boot:run
Application will start after this command. Default port is 8080
An API documentation (Swagger) page is hosted under http://localhost:8080/index.html
POST http://localhost:8080/transactions
Request :
{
"amount": 12.3,
"timestamp": 1478192204000
}
Response :
: http 201
: http 204 (for timestamp value which is older than 60 seconds)
GET http://localhost:8080/statistics
Response :
{
"sum": 1000,
"avg": 100,
"max": 200,
"min": 50,
"count": 10
}