I’m not using a specific endpoint right now. I’m looking for an endpoint so that I can get an ingredient id from an ingredient name and then use that is to get nutrition info about the ingredient
<b>What data endpoint are you using?</b> Usually the ingredient Id is sent along with the name and image, and many other attributes. Depending on your language, should be as easy as grabbing the key from the data. Like so, <b><i>data[“extendedIngredients”]</i><b> and then parse each ingredient in the list.
Anyone have an update?
This still has not been answered. What endpoint will give the food id?
That looks like a good place to start! Thanks
To do this you could search an ingredient name using the Autocomplete Ingredient Search endpoint. Check it out here @ <a href =“https://market.mashape.com/spoonacular/recipe-food-nutrition#autocomplete-ingredient-search”> https://market.mashape.com/spoonacular/recipe-food-nutrition#autocomplete-ingredient-search </a>
<b>For a Query Example:</b>
<a href=#>“https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/food/ingredients/autocomplete?metaInformation=true&number=2&query=beans”</a>
<b>Would return results:</b> <p></p>
<code>[<p></p>
{<p></p>
“name”: “beansprouts”,<p></p>
“image”: “bean-sprouts.jpg”,<p></p>
“id”: 11043,<p></p>
“aisle”: “Ethnic Foods”<p></p>
}, <p></p>
{<p></p>
“name”: “soybeans”,<p></p>
“image”: “soy-beans.jpg”,<p></p>
“id”: 16409,<p></p>
“aisle”: “Canned and Jarred”<p></p>
}<p></p>
] </code>
<p></p>
<p></p>
<p></p>
<b>UPDATE: </b><p></p>
Once you have an id name, make a request for nutritional values:
<a href=#>“https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/food/ingredients/16409/information?amount=100&unit=gram’”</a>
<b>Would Return Results: </b><p></p>
<code>{<p></p>
“id”: 16409,<p></p>
“name”: “soy beans”,<p></p>
“aisle”: “Canned and Jarred”,<p></p>
“image”: “soy-beans.jpg”,<p></p>
“amount”: 100,<p></p>
“unit”: “gram”,<p></p>
“nutrition”: {<p></p>
“nutrients”: [<p></p>
{<p></p>
“title”: “Calories”,<p></p>
“amount”: 173,<p></p>
“unit”: “cal”,<p></p>
“percentOfDailyNeeds”: 8.65<p></p>
},<p></p>
{<p></p>
“title”: “Fat”,<p></p>
“amount”: 8.97,<p></p>
“unit”: “g”,<p></p>
“percentOfDailyNeeds”: 13.8<p></p>
},<p></p>
{<p></p>
“title”: “Saturated Fat”,<p></p>
“amount”: 1.3,<p></p>
“unit”: “g”,<p></p>
“percentOfDailyNeeds”: 8.11<p></p>
},<p></p>
{<p></p>
“title”: “Carbohydrates”,<p></p>
“amount”: 9.93,<p></p>
“unit”: “g”,<p></p>
“percentOfDailyNeeds”: 3.31<p></p>
},… </code>
I’m not using a specific endpoint right now. I’m looking for an endpoint so that I can get an ingredient id from an ingredient name and then use that is to get nutrition info about the ingredient
<b>What data endpoint are you using?</b> Usually the ingredient Id is sent along with the name and image, and many other attributes. Depending on your language, should be as easy as grabbing the key from the data. Like so, <b><i>data[“extendedIngredients”]</i><b> and then parse each ingredient in the list.