Food Filter
The filter
object filters the foods according to different criteria. Within the filter object, it is possible to add AND
or OR
logical operators, these operators are defined as must
or should
respectively.
How to use logical operators
Use the following syntaxis ask to filter fieldName1
and FieldName2
filter: {
must: [
{fieldName1: value1},
{FieldName2: value2}
]
}
Use the following syntaxis ask to filter fieldName1
orFieldName2
filter: {
should: [
{fieldName1: value1},
{FieldName2: value2}
]
}
Add recursive filters by combining must and should operators:
filter: {
should: [
{fieldName1: "value1"},
{
must: [
{fieldName2: "value2"},
{fieldName3: value3}
]
}]
}
For example, the above example describes how to filter value1
information or value2
and value3
values. Each value can have a different field type.
Available fields
Field Name | Type | Description |
| ID | Unique ID retrieved from the |
| String | Edamam o USDA unique ID, known ad foodID
Use this in the following: |
| String | Predefined tag to be added to use it to filter food. Add one or more tags. For example: |
| MealTime | Valid values are: |
| Nutrient | |
| String | Add one or more ingredients. Use this in the recipeSearch query |
| String | Barcode number |
| String | Food Name |
Examples
How to use tags
How to use mealTime
The following example filters the information of lunch and dinner meal times. See an example in the recipeSearch
documentation.
The following example filters the information of lunch or dinner meal times.
How to use ingredients
The following example filters the information by milk OR bread ingredients.
How to use nutrients
The following example filters the information by food that contains Vitamin A and Folic Acid. The nutrient value can be replaced by using any of the values listed on filed name column of the the Nutrient enum table
Last updated