danistark1 / recipesAPI

API endpoints for https://github.com/PascaleStark
0 stars 0 forks source link

APIs #2

Closed danistark1 closed 3 years ago

danistark1 commented 3 years ago

POST

Post a recipe

Field Type Required
name String Yes
prep_time time No
cooking_time time No
category string Yes
directions text Yes
ingredients text Yes
insert_date_time datetime Yes
favorites Integer Yes (should be default 0)
added_by string No
calories string No
cuisine string No
url string No (link to external resources)

Sample POST

{
    "name": "pizza",
    "directions":"put in oven#eat",
    "ingredients": "1 tsp salt#2 tsp sugar",
    "category": "main_dish",
    "cuisine": "italian"
}

Sample response

[
    {
        "id": 3,
        "name": "pizza",
        "prepTime": null,
        "cookingTime": null,
        "servings": null,
        "category": "main_dish",
        "directions": "put in oven, eat",
        "insertDateTime": "2021-04-03 14:54:10",
        "favourites": 0,
        "addedBy": "",
        "calories": null,
        "cuisine": "italian",
        "ingredients": [
            "1 tsp salt",
            "2 tsp sugar"
        ],
        "url": null
    }
]

GetByName

GetWhere

ex. - http://192.168.4.10:8000/recipes/where?id=1

GetSearch

Delete

http://localhost:8000/recipes/delete/{recipeID}

PUT

http://localhost:8000/recipes/update/1

{
    "name": "pizza4",
    "directions": "updated directions2",
    "category": "main_dish"
}

Get Category (Do we need this?)

I need to be able to get a list of categories

when adding a recipe, I have a drop-down that should have all the available categories.

danistark1 commented 3 years ago

@PascaleStark

danistark1 commented 3 years ago

@PascaleStark POST: http://192.168.4.10:8300/recipes

ex.

{
    "name": "pizza",
    "directions":"Preheat the oven to 325 degrees F (165 degrees C)#Generously butter a 9x13 inch baking dish, and coat with some of the bread crumbs. Place the zucchini into the pan, and distribute the cheeses evenly over the top.# In medium bowl, mix together the eggs, milk, salt, baking powder and flour. Spoon over the top of the casserole, and dot with butter. Sprinkle remaining bread crumbs over the top.Bake for 45 minutes in the preheated oven, or until the topping is cooked through. Pick up a piece of the topping and peek underneath to see if it is no longer gooey.",
    "ingredients": "100 g tomatoes#200 tps salt#500 g cheese",
    "category": "main_dish",
    "cuisine": "italian"
}
PascaleStark commented 3 years ago

@danistark1 Received!