This endpoint requires an app ID and app key from https://developer.nutritionix.com/admin/access_details
POST
https://trackapi.nutritionix.com/v2/natural/nutrients
HEADERS
Content-Type:application/json, x-app-id:NutritionixAppID, x-app-key:NutritionixAppKey
BODY:
{
"query":"for breakfast i ate 2 eggs, bacon, and french toast",
"timezone": "US/Eastern"
}
Notes:
- The end user's timezone parameter is optional, but it should be provided to ensure accuracy in time derivations. For example, if the user says "for breakfast" it will assume 8AM in that user's time zone.
- All consumed_at timetamps are reported back from the API in UTC
Hi, I am not getting images and individual details which is listed after Calculate Foods button.
Here are the request and response
Request
var settings = {
“async”: true,
“crossDomain”: true,
“url”: “https://trackapi.nutritionix.com/v2/natural/nutrients”,
“method”: “POST”,
“headers”: {
“content-type”: “application/json”,
“accept”: “application/json”,
“x-app-id”: “039db79f”,
“x-app-key”: “edffc89a0cc7397efe3a456d0349b798”,
“x-remote-user-id”: “0”,
“cache-control”: “no-cache”,
“postman-token”: “fa71a67a-c306-e015-1ccb-f9e7b4dd2424”
},
“processData”: false,
“data”: “{\n \”query\“: \”1 cup spinach\“,\n \”num_servings\“: 1,\n \”aggregate\“: \”string\“,\n \”line_delimited\“: false,\n \”use_raw_foods\“: false,\n \”include_subrecipe\“: false,\n \”timezone\“: \”US/Eastern\“,\n \”consumed_at\“: null,\n \”lat\“: null,\n \”lng\“: null,\n \”meal_type\“: 0,\n \”use_branded_foods\“: false,\n \”locale\“: \”en_US\“\n }”
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Response
{
“foods”: [
{
“food_name”: “string”,
“brand_name”: null,
“serving_qty”: 1,
“serving_unit”: “serving”,
“serving_weight_grams”: 180,
“nf_calories”: 41.4,
“nf_total_fat”: 0.47,
“nf_saturated_fat”: 0.08,
“nf_cholesterol”: 0,
“nf_sodium”: 126,
“nf_total_carbohydrate”: 6.75,
“nf_dietary_fiber”: 4.32,
“nf_sugars”: 0.77,
“nf_protein”: 5.35,
“nf_potassium”: 838.8,
“nf_p”: 100.8,
“full_nutrients”: [
{
“attr_id”: 203,
“value”: 5.346
},
{
“attr_id”: 204,
“value”: 0.468
},
{
“attr_id”: 205,
“value”: 6.75
},
{
“attr_id”: 207,
“value”: 3.258
},
{
“attr_id”: 208,
“value”: 41.4
},
{
“attr_id”: 221,
“value”: 0
},
{
“attr_id”: 255,
“value”: 164.178
},
{
“attr_id”: 262,
“value”: 0
},
{
“attr_id”: 263,
“value”: 0
},
{
“attr_id”: 268,
“value”: 172.8
},
{
“attr_id”: 269,
“value”: 0.774
},
{
“attr_id”: 291,
“value”: 4.32
},
{
“attr_id”: 301,
“value”: 244.8
},
{
“attr_id”: 303,
“value”: 6.426
},
{
“attr_id”: 304,
“value”: 156.6
},
{
“attr_id”: 305,
“value”: 100.8
},
{
“attr_id”: 306,
“value”: 838.8
},
{
“attr_id”: 307,
“value”: 126
},
{
“attr_id”: 309,
“value”: 1.368
},
{
“attr_id”: 312,
“value”: 0.3132
},
{
“attr_id”: 313,
“value”: 68.04
},
{
“attr_id”: 315,
“value”: 1.683
},
{
“attr_id”: 317,
“value”: 2.7
},
{
“attr_id”: 318,
“value”: 18865.8
},
{
“attr_id”: 319,
“value”: 0
},
{
“attr_id”: 320,
“value”: 943.2
},
{
“attr_id”: 321,
“value”: 11318.4
},
{
“attr_id”: 322,
“value”: 0
},
{
“attr_id”: 323,
“value”: 3.744
},
{
“attr_id”: 324,
“value”: 0
},
{
“attr_id”: 328,
“value”: 0
},
{
“attr_id”: 334,
“value”: 0
},
{
“attr_id”: 337,
“value”: 0
},
{
“attr_id”: 338,
“value”: 20354.4
},
{
“attr_id”: 401,
“value”: 17.64
},
{
“attr_id”: 404,
“value”: 0.171
},
{
“attr_id”: 405,
“value”: 0.4248
},
{
“attr_id”: 406,
“value”: 0.882
},
{
“attr_id”: 410,
“value”: 0.261
},
{
“attr_id”: 415,
“value”: 0.4356
},
{
“attr_id”: 417,
“value”: 262.8
},
{
“attr_id”: 418,
“value”: 0
},
{
“attr_id”: 421,
“value”: 35.46
},
{
“attr_id”: 430,
“value”: 888.48
},
{
“attr_id”: 431,
“value”: 0
},
{
“attr_id”: 432,
“value”: 262.8
},
{
“attr_id”: 435,
“value”: 262.8
},
{
“attr_id”: 454,
“value”: 160.2
},
{
“attr_id”: 501,
“value”: 0.072
},
{
“attr_id”: 502,
“value”: 0.2286
},
{
“attr_id”: 503,
“value”: 0.2736
},
{
“attr_id”: 504,
“value”: 0.4158
},
{
“attr_id”: 505,
“value”: 0.3276
},
{
“attr_id”: 506,
“value”: 0.099
},
{
“attr_id”: 507,
“value”: 0.063
},
{
“attr_id”: 508,
“value”: 0.2412
},
{
“attr_id”: 509,
“value”: 0.2034
},
{
“attr_id”: 510,
“value”: 0.3024
},
{
“attr_id”: 511,
“value”: 0.3024
},
{
“attr_id”: 512,
“value”: 0.1188
},
{
“attr_id”: 513,
“value”: 0.2646
},
{
“attr_id”: 514,
“value”: 0.45
},
{
“attr_id”: 515,
“value”: 0.6426
},
{
“attr_id”: 516,
“value”: 0.252
},
{
“attr_id”: 517,
“value”: 0.2088
},
{
“attr_id”: 518,
“value”: 0.1926
},
{
“attr_id”: 601,
“value”: 0
},
{
“attr_id”: 605,
“value”: 0
},
{
“attr_id”: 606,
“value”: 0.0774
},
{
“attr_id”: 607,
“value”: 0
},
{
“attr_id”: 608,
“value”: 0
},
{
“attr_id”: 609,
“value”: 0
},
{
“attr_id”: 610,
“value”: 0
},
{
“attr_id”: 611,
“value”: 0
},
{
“attr_id”: 612,
“value”: 0.0108
},
{
“attr_id”: 613,
“value”: 0.0594
},
{
“attr_id”: 614,
“value”: 0.0054
},
{
“attr_id”: 617,
“value”: 0.0054
},
{
“attr_id”: 618,
“value”: 0.0306
},
{
“attr_id”: 619,
“value”: 0.1656
},
{
“attr_id”: 620,
“value”: 0
},
{
“attr_id”: 621,
“value”: 0
},
{
“attr_id”: 626,
“value”: 0.0054
},
{
“attr_id”: 627,
“value”: 0
},
{
“attr_id”: 628,
“value”: 0
},
{
“attr_id”: 629,
“value”: 0
},
{
“attr_id”: 630,
“value”: 0
},
{
“attr_id”: 631,
“value”: 0
},
{
“attr_id”: 645,
“value”: 0.0108
},
{
“attr_id”: 646,
“value”: 0.1962
}
],
“nix_brand_name”: null,
“nix_brand_id”: null,
“nix_item_name”: null,
“nix_item_id”: null,
“upc”: null,
“consumed_at”: “2018-08-06T03:59:36+00:00”,
“metadata”: {},
“source”: null,
“ndb_no”: null,
“tags”: null,
“alt_measures”: null,
“lat”: null,
“lng”: null,
“meal_type”: 0,
“photo”: {
“thumb”: “https://d2eawub7utcl6.cloudfront.net/images/nix-apple-grey.png”,
“highres”: null,
“is_user_uploaded”: false
},
“sub_recipe”: null
}
]
}