MOVED TO -> https://gitlab.com/austent89/spark-rest-example
Run Tests
cd /some/path/spark-rest-example/
gradle checkBuild Shadow Jar
gradle shadowJargradle shadowJar
cd /build/libs
java -jar -port 9000 spark-rest-example-{VERSION}-all.jarcurl -X POST \
http://localhost:9000/parking/import/rates \
-H 'accept: application/json' \
-H 'cache-control: no-cache' \
-d '{
"rates": [
{
"days": "mon,tues,thurs",
"times": "0900-2100",
"price": 1500
},
{
"days": "fri,sat,sun",
"times": "0900-2100",
"price": 2000
},
{
"days": "wed",
"times": "0600-1800",
"price": 1750
},
{
"days": "mon,wed,sat",
"times": "0100-0500",
"price": 1000
},
{
"days": "sun,tues",
"times": "0100-0700",
"price": 925
}
]
}'Reponse
{"status":"Success","message":"Rates Created"}curl -X GET \
http://localhost:9000/parking/rates \
-H 'accept: application/json'Response
{
"status":"Success",
"message":"Current Rates",
"data":{
"rates":[
{
"id":1,
"times":"0900-2100",
"price":1500,
"days":"mon,tues,thurs",
"validations":[
]
},
{
"id":2,
"times":"0900-2100",
"price":2000,
"days":"fri,sat,sun",
"validations":[
]
},
{
"id":3,
"times":"0600-1800",
"price":1750,
"days":"wed",
"validations":[
]
},
{
"id":4,
"times":"0100-0500",
"price":1000,
"days":"mon,wed,sat",
"validations":[
]
},
{
"id":5,
"times":"0100-0700",
"price":925,
"days":"sun,tues",
"validations":[
]
}
]
}
}curl -X GET \
'http://localhost:9000/parking/availability?start_time=2015-07-01T07%3A00%3A00Z&end_time=2015-07-01T12%3A00%3A00Z' \
-H 'accept: application/json' \
-H 'cache-control: no-cache'response
{"status":"Success","message":"Rate Found","data":1750}