Проект по выбору ресторана для обеда по тестовому заданию
Технологии : Maven/ Spring/ JPA(Hibernate)/ REST(Jackson)/ PostrgeSQL/ Tomcat/ Logback
Ответы в формате json, post запросы в json.
Метод | Действие | Запрос | Пример |
---|---|---|---|
GET | Все рестораны с меню | / |
/ |
GET | Все рестораны с меню на дату | /date/ LocalDate |
/date/2017-07-26 |
GET | Ресторан с меню | / id |
/100004 |
GET | Ресторан с меню на дату | / id/LocalDate |
/100004/2017-07-26 |
POST | Новый ресторан с меню | / {restaurantWithMenu} |
/{restaurantWithMenu} |
PUT | Обновить ресторан с меню | / {restaurantWithMenu} |
/{restaurantWithMenu} |
DELETE | Удалить ресторан | / id |
/100004 |
DELETE | Удалить все рестораны | / |
/ |
Примеры curl:
- curl "http://localhost:8080/dem/rest/restaurants/"
- curl "http://localhost:8080/dem/rest/restaurants/date/2017-07-26"
- curl "http://localhost:8080/dem/rest/restaurants/100004"
- curl "http://localhost:8080/dem/rest/restaurants/100004/2017-07-26"
- curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"id":0,"name":"New Restaurant","menu":[{"id":0,"restaurantId":0,"description":"Борщ","date":"2017-07-26","price":500},{"id":0,"restaurantId":0,"description":"Шашлык","date":"2017-07-26","price":500},{"id":0,"restaurantId":0,"description":"Картофель жаренный","date":"2017-07-26","price":500},{"id":0,"restaurantId":0,"description":"Водка","date":"2017-07-26","price":540}]}' http://localhost:8080/dem/rest/restaurants
- curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X PUT -d '{"id":100004,"name":"Берёзка","menu":[{"id":100007,"restaurantId":100004,"description":"Борщ","date":"2017-07-26","price":500},{"id":100008,"restaurantId":100004,"description":"Шашлык","date":"2017-07-26","price":500},{"id":100009,"restaurantId":100004,"description":"Картофель жаренный","date":"2017-07-26","price":500},{"id":100010,"restaurantId":100004,"description":"Водка","date":"2017-07-26","price":540}]}' http://localhost:8080/dem/rest/restaurants
- curl -X DELETE http://localhost:8080/dem/rest/restaurants/100005
- curl -X DELETE http://localhost:8080/dem/rest/restaurants/
Ответы в формате json, post запросы в json.
Метод | Действие | Запрос | Пример |
---|---|---|---|
GET | Все голоса | / |
/ |
GET | Голоса на дату | /date/ LocalDate |
/date/2017-10-02 |
GET | id победителя на дату | /winner/ LocalDate |
/winner/2017-10-02 |
POST | Новый голос | / {vote} |
/{vote} |
PUT | Изменить решение | / {vote} |
/{vote} |
Примеры curl:
- curl "http://localhost:8080/dem/rest/votes/"
- curl "http://localhost:8080/dem/rest/votes/date/2017-07-26"
- curl "http://localhost:8080/dem/rest/votes/100021"
- curl "http://localhost:8080/dem/rest/votes/winner/2017-07-26"
- curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"date":"2017-07-27","userId":100000,"restaurantId":100005}' http://localhost:8080/dem/rest/votes
- curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X PUT -d '{"id":100021,"date":"2017-07-26","userId":100000,"restaurantId":100005}' http://localhost:8080/dem/rest/votes
Ответы в формате json, post запросы в json.
Метод | Действие | Запрос | Пример |
---|---|---|---|
GET | Блюдо | / |
/100019 |
GET | Меню ресторана | /restaurant/ id |
/restaurant/100004 |
GET | Меню ресторана на дату | /restaurant/ id/LocalDate |
/restaurant/100004/2017-07-26 |
POST | Новое блюдо | /create {meal} |
/create {meal} |
PUT | Обновить блюдо | /update {meal} |
/update {meal} |
DELETE | Удалить блюдо | / id |
/ 100024 |
DELETE | Удалить все блюда | / |
/ |
DELETE | Удалить все блюда за дату | /date/ LocalDate |
/date/2017-07-26 |
DELETE | Удалить блюда ресторана | /restaurant/ restaurantId |
/restaurant/100004 |
DELETE | Удалить блюда ресторана за дату | /restaurant/ restaurantId/LocalDate |
/restaurant/100004/2017-07-26 |
Примеры curl:
- curl "http://localhost:8080/dem/rest/meals/100019"
- curl "http://localhost:8080/dem/rest/meals/restaurant/100004"
- curl "http://localhost:8080/dem/rest/meals/restaurant/100004/2017-07-26"
- curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d '{"id":0,"restaurantId":100004,"description":"Башмачок","date":"2017-07-26","price":200}' http://localhost:8080/dem/rest/meals/create
- curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X PUT -d '{"id":100010,"restaurantId":100004,"description":"Башмачок","date":"2017-07-26","price":210}' http://localhost:8080/dem/rest/meals/update
- curl -X DELETE http://localhost:8080/dem/rest/meals/100024
- curl -X DELETE http://localhost:8080/dem/rest/meals/
- curl -X DELETE http://localhost:8080/dem/rest/meals/date/2017-07-26
- curl -X DELETE http://localhost:8080/dem/rest/meals/restaurant/100004
- curl -X DELETE http://localhost:8080/dem/rest/meals/restaurant/100004/2017-07-26