API Docs
Overview
You can access the API documentation by running the application and visiting the /docs
endpoint. The API documentation is generated using Swagger UI and provides a user-friendly interface to interact with the API.
Visit the /docs
endpoint in your browser to access the API documentation: http://localhost:8000/docs
API Endpoints
There are 3 main API endpoints in the Foodinator application:
1 . /recommend
: This endpoint takes a user preferences as input and returns a list of recommended food items based on the input list.
POST Request Body:
{
"food_type": "string",
"allergies": [
"string"
],
"ingredients": [
"string"
],
"calories": 0,
"fat_content": 0,
"protein_content": 0,
}
Curl Request:
curl -X 'POST' \
'http://localhost:8000/recommend/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"food_type": "Non-veg",
"allergies": [
"None"
],
"ingredients": [
"chicken", "salt"
],
"calories": 700,
"fat_content": 20,
"protein_content": 40
}'
Response:
[
{
"id": 1,
"food": "string"
},
{
"id": 2,
"food": "string"
},
{
"id": 3,
"food": "string"
},
{
"id": 4,
"food": "string"
},
{
"id": 5,
"food": "string"
}
]
2 . /fetch-food-details
: This endpoint takes a food item name as input and returns the details of the food item.
GET Request:
curl -X GET "http://localhost:8000/fetch-food-details?food=string" -H "accept: application/json"
Response:
{
"_id": "string",
"id": 0,
"food": "string",
"image": "string",
"instructions": "string",
"food_type": "string",
"Calories": 0,
"FatContent": 0,
"ProteinContent": 0,
"glutenFree": boolean,
"dairyFree": boolean,
"sourceUrl": "string",
"ingredients": "list of strings"
}
3 . /food_search
: This endpoint takes a food item name as input and returns a list of food items that match the input name.
POST Request:
curl -X POST "http://localhost:8000/food_search?food=string" -H "accept: application/json" -d ''
Response:
[
{
"id": 1,
"food": "string"
},
{
"id": 2,
"food": "string"
},
{
"id": 3,
"food": "string"
},
{
"id": 4,
"food": "string"
},
{
"id": 5,
"food": "string"
}
]