Open Zoomea opened 8 months ago
Do we want to add the cooking instructions as well?
Here is a draft API. Does this look good to you?
POST /api/recipe
Provide in JSON body
{
"name": "Example Recipe",
"description": "Example description",
"prepTimeMins": 70, # meaning 1hr 10min preparation time
"cookTimeMins": 90, # meaning its 1hr 30min cooking time
"difficulty": 3,
"ingredients": [
{
"name": "cumin",
"quantity": 10,
"unit": "grams"
},
{
"name": "tomato",
"quantity": 2,
"unit": "" # Omit if no unit of measurement is required
},
]
}
It will then return
{
"data": 5, # the id of the recipe that has been created
"error": ""
}
The full information of the recipe can then be obtained by calling GET /api/recipe/5
When user fills in the form and click save, should add the recipe information to the database.
This might also be used when user updates the recipe.