The following repo contains spring boot rest api tennis court reservation server application.
For building and running this application you need:
There are several ways to run a Spring boot application on your local machine.
One way is to execute the main
method in the cz.Main
class from your IDE.
Alternatively you can use the Spring Boot Maven plugin like so:
mvn spring-boot:run
The service is just a simple tennis court reservation REST service. It uses an in-memory database (H2) to store the data.
Here are some endpoints you can call:
Post /api/surfaces
Accept: application/json
Content-Type: application/json
{
"name": "dirt"
}
Response: HTTP 201 (Created)
Content: Surface
Get /api/surfaces/1
Content-Type: application/json
Response: HTTP 200
Content: Surface
Get /api/surfaces
Content-Type: application/json
Response: HTTP 200
Content: Array
Put /api/surfaces
Accept: application/json
Content-Type: application/json
{
"id": "1",
"name": "gravel"
}
Response: HTTP 200
Content: Surface
Delete /api/surfaces/1
Response: HTTP 200
Post /api/courts
Accept: application/json
Content-Type: application/json
{
"surfaceId": "1",
"hourPrice": "10.25"
}
Response: HTTP 201 (Created!
Content: Court
Get /api/courts/1
Content-Type: application/json
Response: HTTP 200
Content: Court
Get /api/courts
Content-Type: application/json
Response: HTTP 200
Content: Array
Put /api/courts
Accept: application/json
Content-Type: application/json
{
"id": "1",
"surfaceId": "1",
"hourPrice": "2.25"
Response: HTTP 200
Content: Court
}
Delete /api/courts/1
Response: HTTP 200
Post /api/reservations
Accept: application/json
Content-Type: application/json
{
"courtId": "1",
"phoneNumber": "+420558445215",
"userName": "Jakub",
"startDate": "2024-10-10T10:50:00",
"duration": "180",
"reservationType": "Singles"
}
Response: HTTP 201 (Created)
Content: Double
Get /api/reservations/1
Content-Type: application/json
Response: HTTP 200
Content: Reservation
Get /api/reservations?phoneNumber=+421584526374
Content-Type: application-json
Response: HTTP 200
Content: Array
Get /api/reservations
Content-Type: application-json
Response: HTTP 200
Content: Array
Put /api/reservations
Accepted: application/json
{
"id": "1",
"courtId": "1",
"phoneNumber": "+420558445215",
"userName": "Jakub",
"startDate": "2024-10-10T10:50:00",
"duration": "180",
"reservationType": "Singles"
}
Response: HTTP 200
Delete /api/reservations/1
Response: HTTP 200