Common Foods Search

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.

Characteristics

Within the common food search you are able to:

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:

Where:

  • weight is equivalent the gramWeightfield included within the portions object

Available Arguments

Define at least one argument within the query.

Available Fields

Pagination

The commonFood query supports the use of pagination. The following fields can be used

 pageInfo{
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }

Example

Get the nutritional information of a specific food

{
  commonFoods(
    filter: {
      id: "Q29tbW9uRm9vZE5vZGU6N2QyYTY0NDUtN2MwZi00ZTYxLTlkNjctYTA4ZWI2NDhlNTY3"
    }
  ) {
    edges {
      node {
        id
        name
        description
        nutrients {
          type
          amount
          name
          unit
        }
        portions {
          amount
          gramWeight
          modifier
        }
      }
    }
  }
}

Get the list of foods that contain "milk chocolate"

{
  commonFoods(query: "milk chocolate", first: 1) {
    edges {
      node {
        id
        name
        portions {
          modifier
          amount
          gramWeight
        }
        nutrients {
          type
          amount
          name
          unit
        }
      }
    }
  }
}