This project is REST API for automatic generating food menu considering parametres and objectives of person.
###1) To work with this API the first thing you need is Task. Task format (JSON) :
{
"userID" : "some_username",
"sex" : "male/female (default: male)",
"age" : "years_integer (default: 25)",
"height" : "cm/inches_double (default: 175cm)",
"weight" : "kg/pounds_double (default: 75kg)",
"activity_level" : "one_of: sedentary,light,moderate,high,extra_high (default:light)",
"body_type" : "one_of: fat,normal,athlete,thin (default: normal)",
"foodItems" : ["food_item_name1", "..."],
"metricUS" : "0/1 (default: 0 - metric[kg,cm])"
}Example :
{
"userID" : "masha90",
"sex" : "female",
"age" : 18,
"height" : 160.0,
"weight" : 53.0,
"activity_level" : "light",
"body_type" : "normal",
"foodItems" : ["apple", "potato", "chicken"],
"metricUS" : 0
}API endpoint :
| Endpoint | Request type | Consumes | Produces |
| https://ufoodo.com/mongorest/control/get-menu | PUT | application/json;charset=utf-8 | text/plain |
Example output of this API call with example task above :
{
"userID" : "masha90",
"task" :
{
"properties" :
{
"sex" : "female",
"age" : 18,
"height" : 160.0,
"weight" : 53.0,
"activity_level" : "light",
"body_type" : "normal",
"metricUS" : 0
},
"foodItems" : ["apple", "potato", "chicken"]
},
"menu0" :
{
"calories" : 480.0,
"proteins" : 180.0,
"carbohydrates" : 185.0,
"fats" : 100.0,
"dishes" : [
{
"name" : "soup",
"calories" : 290.0,
"proteins" : 100.0,
"carbohydrates" : 130.0,
"fats" : 60.0,
"food_items" : [
{
"name" : "chicken",
"calories" : 200.0,
"proteins" : 50.0,
"carbohydrates" : 100.0,
"fats" : 50.0,
"quantity" : 1.0
},
{
"name" : "potato",
"calories" : 90.0,
"proteins" : 50.0,
"carbohydrates" : 30.0,
"fats" : 10.0,
"quantity" : 1.0
}]
},
{
"name" : "apple salat",
"calories" : 100.0,
"proteins" : 30.0,
"carbohydrates" : 25.0,
"fats" : 30.0,
"food_items" : [
{
"name" : "apple",
"calories" : 100.0,
"proteins" : 30.0,
"carbohydrates" : 25.0,
"fats" : 30.0,
"quantity" : 1.0
}]
},
{
"name" : "boiled potatoes",
"calories" : 90.0,
"proteins" : 50.0,
"carbohydrates" : 30.0,
"fats" : 10.0,
"food_items" : [
{
"name" : "potato",
"calories" : 90.0,
"proteins" : 50.0,
"carbohydrates" : 30.0,
"fats" : 10.0,
"quantity" : 1.0
}]
}]
}
}API endpoints :
| Endpoint | Request type | Consumes | Produces |
| https://ufoodo.com/mongorest/control/admin/add-fooditem | PUT | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/admin/add-dish | PUT | application/json;charset=utf-8 | text/plain |
Example food_item to insert :
{
"name" : "chicken",
"calories" : 200.0,
"proteins" : 50.0,
"carbohydrates" : 100.0,
"fats" : 50.0,
"quantity" : 1.0
}Example dish to insert :
-
- full json
{
"name" : "boiled potatoes",
"calories" : 90.0,
"proteins" : 50.0,
"carbohydrates" : 30.0,
"fats" : 10.0,
"food_items" : [
{
"name" : "potato",
"calories" : 90.0,
"proteins" : 50.0,
"carbohydrates" : 30.0,
"fats" : 10.0,
"quantity" : 1.0
}
]
}-
- short json (once this dish will be included in some menu it will be automatically replaced in Database with full form)
{
"name" : "boiled potatoes",
"calories" : 90.0,
"proteins" : 50.0,
"carbohydrates" : 30.0,
"fats" : 10.0,
"food_items" : ["potato"]
}As result you will get answer like :
{ "message" : "dish inserted"}or
{ "message" : "food_item inserted"}API endpoints :
| Endpoint | Request type | Consumes | Produces |
| https://ufoodo.com/mongorest/control/get-fooditems | GET | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/get-dishes | GET | application/json;charset=utf-8 | text/plain |
Result will look like :
{"food_items" : []}or
{"dishes" : []}API endpoints :
| Endpoint | Request type | Consumes | Produces |
| https://ufoodo.com/mongorest/control/search-fooditems | PUT | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/search-dishes | PUT | application/json;charset=utf-8 | text/plain |
Request example :
{ "name" : "ap" }Result of resuest above :
{
"found_items" : [
{
"_id" : { "$oid" : "56b899675daf813030836654" },
"name" : "apple",
"calories" : 100,
"proteins" : 30,
"carbohydrates" : 25,
"fats" : 30,
"quantity" : 1
}]
}| Endpoint | Request type | Consumes | Produces |
| https://ufoodo.com/mongorest/control/get-menu | PUT | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/admin/add-fooditem | PUT | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/admin/add-dish | PUT | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/get-fooditems | GET | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/get-dishes | GET | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/search-fooditems | PUT | application/json;charset=utf-8 | text/plain |
| https://ufoodo.com/mongorest/control/search-dishes | PUT | application/json;charset=utf-8 | text/plain |