The commonFoods query allows users to search for any type of common food. Within the search, food can be filtered by using tags.
Common foods are known as the most intake foods on a daily basis. Among these common foods, we can find apples, cookies, milk, rice, sugar, noodles, etc.
How to calculate the nutrient according to a food portion
Common food nutrients are per each 100g. The value can be different depending on the portion of each food. For example, the weight of a small banana can be 20g, while a big banana can weigh 30g. To calculate the nutrients, use the following equation:
nutrientvalue∗weight/100
Where:
weight is equivalent the gramWeightfield included within the portions object
Available Arguments
Define at least one argument within the query.
Argument Name
Type
Description
query
Query
Name or keyword of the food. It is possible to add more than one value. The query is case insensitive.
The commonFood query supports the use of pagination. The following fields can be used
Example
Get the nutritional information of a specific food
Get the list of foods that contain "milk chocolate"
UI/UX example
In the same way, we have code examples, this is an implementation example in which see results of the API execution in the Suggestic App.
Login to the App, tap on the Food Log + option, choose the Candies, Milk chocolate recipe (the same recipe retrieved in the above example) and the nutrition information is displayed along with the different available portions for the given recipe:
Use pagination to get the first results of foods that contain bread
Filter all the common foods that include the "fat-free" tag
Filter all the common foods that include the "fat-free" and "caffeine-free" tags
Get all the common foods that contain Vitamin A and Folic Acid