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
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

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

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

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