API usage

Access

A free API endpoint is provided here: ernl.dev/meal/api. Please do not send too many requests, the API usage is subject to rate limiting.

/create request

You may query the webserver to generate a personalized meal plan by specifying the required parameters:

Query

URL is ernl.dev/meal/api/create

Parameters

  1. age: Integer in range [10, 105]
  2. height: Float in range [90, 230] in centimeters
  3. weight: Float in range [90, 250] in kg
  4. sex: Integer where 0 is male and 1 is female
  5. exercise_level: Integer in range [0, 3] where:
    0 represents Sedentary, 1 is Lightly active (exercise 1-3 days/week), 2 is Moderately active (exercise 3-5 days/week) and 3 is Active (intense exercise 6-7 days/week)

Example

Input
An example would be ernl.dev/api/create/?age=20&height=180&weight=70&sex=1&exercise_level=1
Output:

{
"dinner": [
{
"fat": 19.173419124182743,
"id": "f44ce8c943",
"kcalories": 1075.25,
"name": "Vegetarian Rice",
"protein": 54.60440076441424,
"salt": 19.173419124182743,
"saturates": 3.0896738597981295,
"sugars": 6.525368084223827,
"type": "main",
"weight": 516.588100223201
},
{
"fat": 8.77171943170377,
"id": "6ca7c5f254",
"kcalories": 232.2004698512138,
"name": "Strawberry Yogurt Scones",
"protein": 6.547980758474104,
"salt": 8.77171943170377,
"saturates": 5.253733079762838,
"sugars": 1.107998657567961,
"type": "dessert",
"weight": 80
}
],
"lunch": [
{
"fat": 69.98987312439596,
"id": "0f9491fe4b",
"kcalories": 1075.2500000000002,
"name": "Microwave Risotto",
"protein": 46.10079860427664,
"salt": 69.98987312439596,
"saturates": 23.86226323046006,
"sugars": 37.73693720845762,
"type": "main",
"weight": 433.0395391330363
},
{
"fat": 8.417920735209648,
"id": "ffad70d2c2",
"kcalories": 476.51565192418144,
"name": "Microwave Sweet Nuts",
"protein": 3.588846607952006,
"salt": 8.417920735209648,
"saturates": 0.6660704256812815,
"sugars": 99.18483071670178,
"type": "dessert",
"weight": 118
}
]
}