REST Web service that allows registered users
- Save their recipes
- Update their recipes
- Delete their recipes
- Search for others recipes
POST /api/signup
Request body
{
"email" : "admin@example.com",
"password" : "p4ssword"
}
POST /api/recipe/new
Request body
{
"name" : "Fresh Mint Tea",
"category" : "beverage",
"description": "Light, aromatic and refreshing beverage, ...",
"ingredients": ["boiled water", "honey", "fresh mint leaves"],
"directions": ["Boil water", "Pour boiling hot water into a mug", "Add fresh mint leaves",
"Mix and let the mint leaves seep for 3-5 minutes", "Add honey and mix again"]
}
GET /api/recipe/{id}
Parameter | Type | Description |
---|---|---|
id |
@Path |
Required. Id of recipe to fetch |
Returns recipe with specified id.
GET /api/recipe/all
Returns all recipes
GET /api/recipe/search
Parameter | Type | Description |
---|---|---|
category |
string |
Not required. Category of a recipe to fetch |
name |
string |
Not required. Name of a recipe to fetch |
Returns a recipe with specified category or name.
DELETE /api/recipe/{id}
Parameter | Type | Description |
---|---|---|
id |
@Path |
Required. Id of recipe to delete |
Deletes recipe with specified id.
PUT /api/recipe/{id}
Parameter | Type | Description |
---|---|---|
id |
@Path |
Required. Id of recipe to update |
Request body
{
"name": "Warming Ginger Tea",
"category": "beverage",
"description": "Ginger tea is a warming drink for cool weather, ...",
"ingredients": ["1 inch ginger root, minced", "1/2 lemon, juiced", "1/2 teaspoon manuka honey"],
"directions": ["Place all ingredients in a mug and fill with warm water (not too hot so you keep the beneficial honey compounds in tact)",
"Steep for 5-10 minutes", "Drink and enjoy"]
}
Updates recipe with specified id.
- Navigate to the project directory
cd <project-name>
- Execute maven tasks
./mvnw clean package
- Jar file wil be located in the /target folder
- Go to the project directory
cd /target
- Start the application
java -jar RecipeWebService-1.1.jar