REST API for travel agency
Using docker:
docker compose up
GET /cities
[
{
"id" : 1,
"name" : "Moscow"
},
{
"id" : 2,
"name" : "Tambov"
}
]
GET /cities/{id}
{
"id" : 1,
"name" : "Moscow"
}
POST /cities
Param | Type | Description |
---|---|---|
name | String | City name |
{
"id": 3,
"name": "Tomsk"
}
PATCH /cities/{id}
To make tours from city to country pass country id in request.
Param | Type | Description |
---|---|---|
optionalName | String | City name |
optionalCountryId | Long | Country id |
{
"id": 3,
"name": "Omsk"
}
DELETE /cities/{id}
GET /countries
[
{
"id" : 1,
"name" : "Russia"
},
{
"id" : 2,
"name" : "Turkey"
}
]
GET /countries/{id}
{
"id" : 1,
"name" : "Russia"
}
POST /countries
Param | Type | Description |
---|---|---|
name | String | Country name |
{
"id": 3,
"name": "Italy"
}
PATCH /countries/{id}
Param | Type | Description |
---|---|---|
optionalName | String | City name |
optionalCityId | Long | City id |
optionalTourId | Long | Tour id |
{
"id": 3,
"name": "Omsk"
}
DELETE /countries/{id}
GET /tours
[
{
"id" : 1,
"name" : "tour-name-1",
"description" : "Description",
"price" : 3000,
"distance" : 500,
"seaResort" : true,
"beach" : "Sand",
"wirelessInternet" : true,
"meal" : true
},
{
"id" : 2,
"name" : "tour-name-2",
"description" : "Description",
"price" : 5000,
"distance" : null,
"seaResort" : false,
"beach" : null,
"wirelessInternet" : false,
"meal" : true
}
]
GET /tours/{id}
{
"id" : 1,
"name" : "tour-name-1",
"description" : "Description",
"price" : 3000,
"distance" : 500,
"seaResort" : true,
"beach" : "Sand",
"wirelessInternet" : true,
"meal" : true
}
POST /tours/countries/{country_id}
County id - id of country where tour is located.
Param | Type | Description |
---|---|---|
name | String | City name |
description | String | Description of the tour |
price | Long | Tour price per one day for one person |
optionalDistance | Short | Distance to the sea |
seaResort | boolean | Shows the tour is next to the sea or not |
optionalBeach | String | Type of the beach |
wirelessInternet | boolean | Tour has wireless internet |
meal | boolean | Tour provides meal |
{
"id" : 3,
"name" : "tour-name-3",
"description" : "Description",
"price" : 3000,
"distance" : 300,
"seaResort" : true,
"beach" : "Pebble",
"wirelessInternet" : true,
"meal" : true
}
DELETE /tours/{id}
GET /tours/find/{country_id}
Returns list of available tours from city to country with calculated prices.
Param | Type | Description |
---|---|---|
cityId | Long | City id |
days | int | Amount of days |
people | int | Amount of people |
[
{
"id" : 1,
"name" : "tour-name-1",
"description" : "Description",
"calculatedPrice" : 6000,
"distance" : 500,
"seaResort" : true,
"beach" : "Sand",
"wirelessInternet" : true,
"meal" : true
},
{
"id" : 2,
"name" : "tour-name-2",
"description" : "Description",
"calculatedPrice" : 10000,
"distance" : null,
"seaResort" : false,
"beach" : null,
"wirelessInternet" : false,
"meal" : true
}
]