API Documentation and Features
Here you can find the documentation for SmartOven’s main features.
Recipes Management
Application provides a list of endpoints for Creating, Reading, Updating and Deleting of the recipes from ovens database.
- GET /recipe
Returns all recipes that are stored in oven’s database.
Example request
GET /recipe HTTP/1.1 Host: localhost:5000 Accept: application/json
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json [ { "name": "Banana-Bread", "prep_time": 10, "prep_details": "Details for baking Banana Bread", "baking_temperature": 30 }, { "name": "Apple-Pie", "prep_time": 40, "prep_details": "Details for baking Apple Pie", "baking_temperature": 50 } ]
- Status Codes
200 OK – Successfully returned a list of recipes
- GET /recipe/{recipe_name}
Returns the recipes that has the specified name.
Example request
GET /recipe/test-recipe HTTP/1.1 Host: localhost:5000 Accept: application/json
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "id": "1", "name": "test-recipe", "prep_time": 40, "prep_details": "Details test recipe", "baking_temperature": 50 }
- Status Codes
200 OK – Successfully returned a list of recipes
400 Bad Request – Bad get recipe request (name is not specified)
404 Not Found – The recipe with the specified name wasn’t found
- POST /recipe
Adds a new recipe to oven’s database.
Example request
POST /recipe HTTP/1.1 Host: localhost:5000 Accept: application/json { "name": "test-recipe", "prep_time": 40, "prep_details": "Details test recipe", "baking_temperature": 50 }
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "id": "1", "message": "Successfully added a new recipe" }
- Status Codes
200 OK – Successfully added a new recipe
400 Bad Request – Some parameters are not specified
409 Conflict – The recipe with the specified name already exists
- PUT /recipe/{recipe_id}
Updates an existing recipe from oven’s database.
Example request
PUT /recipe/1 HTTP/1.1 Host: localhost:5000 Accept: application/json { "name": "test-recipe-updated", "prep_time": 50, }
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "message": "Successfully updated the recipe" }
- Status Codes
200 OK – Successfully updated the recipe
400 Bad Request – Recipe is missing or has unallowed fields
409 Conflict – Recipe does not exist
500 Internal Server Error – Server error during recipe update
- DELETE /recipe/{recipe_id}
Deletes an existing recipe from oven’s database.
Example request
DELETE /recipe/1 HTTP/1.1 Host: localhost:5000 Accept: application/json
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "message": "Successfully deleted the recipe with id 1" }
- Status Codes
200 OK – Successfully deleted the recipe
409 Conflict – Recipe does not exist
Recipe Search
Our application can make a request to an external API that contains a big database of recipes and search through them.
- POST /recipe/find
Searches for a new recipe online and if one recipe has been found, take it and add it to oven’s database, if it doesn’t exist already.
Example request
POST /recipe/find HTTP/1.1 Host: localhost:5000 Accept: application/json { "name": "Banana bread" }
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "name": "Banana bread", "prep_time": 10, "prep_details": "Details banana bread preparation", "baking_temperature": 50 }
- Status Codes
200 OK – Successfully found and added the searched recipe
400 Bad Request – Missing fields to search for recipe
401 Unauthorized – The client is not authorized to search
404 Not Found – Recipe was not found online
409 Conflict – The recipe with the specified name already exists
Oven Status
User can check oven’s status (temperature, time left for baking, if it’s on/off, current recipe).
- GET /oven/{oven_id}
Returns the status of the oven with the specified name.
Example request
GET /oven/oven-33d6ee15-6753-496b-b838-517ef329b815 HTTP/1.1 Host: localhost:5000 Accept: application/json
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "recipe": {}, "state": false, "temperature": { "current_temperature": 22, "target_temperature": 0 }, "time": { "target_time": 0, "time_elapsed": 0, "time_left": 0 } }
- Status Codes
200 OK – Successfully returned the specified oven’s info
400 Bad Request – Missing oven ID
404 Not Found – Oven not found
Selecting a recipe
The user can select a recipe from the database and bake it.
- POST /oven/{oven_id}/recipe/{recipe_name}
Assigns the specified recipe to the oven with specified id.
Example request
POST /oven/oven-33d6ee15-6753-496b-b838-517ef329b815/recipe/Banana-bread HTTP/1.1 Host: localhost:5000 Accept: application/json
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "message": "Success" }
- Status Codes
200 OK – Successfully added the recipe to the oven
404 Not Found – Not found oven/recipe with specified id/name
Turning the oven on/off
The user can turn on and off the oven
- POST /oven/{oven_id}/state
Turns the oven on or off, if it wasn’t already.
Example request
POST /oven/oven-33d6ee15-6753-496b-b838-517ef329b815/state HTTP/1.1 Host: localhost:5000 Accept: application/json { "state": true }
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "message": "Success" }
- Status Codes
200 OK – Successfully changed oven’s state
400 Bad Request – Missing state parameter or bad state value
404 Not Found – Not found oven with specified id
Manage oven’s temperature
The user can manage the temperature of the oven
- POST /oven/{oven_id}/temperature
Changes the temperature of oven with the specified one.
Example request
POST /oven/oven-33d6ee15-6753-496b-b838-517ef329b815/temperature HTTP/1.1 Host: localhost:5000 Accept: application/json { "temperature": 50 }
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "message": "Success" }
- Status Codes
200 OK – Successfully changed oven’s temperature
400 Bad Request – Missing temperature parameter or bad state value
404 Not Found – Not found oven with specified id
Manage oven’s time
The user can manage the time of the oven
- POST /oven/{oven_id}/time
Changes the time of oven with the specified one.
Example request
POST /oven/oven-33d6ee15-6753-496b-b838-517ef329b815/time HTTP/1.1 Host: localhost:5000 Accept: application/json { "time": 50 }
Example response
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json { "message": "Success" }
- Status Codes
200 OK – Successfully changed oven’s time
400 Bad Request – Missing time parameter or bad state value
404 Not Found – Not found oven with specified id