Get Food
GET https://api.whisk.com/food/v2/get
Description
Returns brand, nutrition data and available measurements for food
Parameters
Name | Optional | Type | Description |
---|---|---|---|
food_hits | no | array[string] | Food identifiers to be fetched |
response_mask.paths | yes | array[string] | List of top level fields of result model to be returned. Minimal required set of fields should be specified to reduce payload size |
Request example
The recommended set of fields to request to cover the common use case of displaying a product is
Response
Data returned in JSON. Empty strings, zero values, empty arrays and null values are not returned.
Json response example with the proper response_mask.paths specified
Core Attributes
In case response_mask.paths
brand, title, nutrition, measures
as in the example above are passed
Name | Optional | Type | Description |
---|---|---|---|
title | no | string | Localized food name |
brand | yes | string | Brand name |
measures | yes | object | Wrapper object for a list of measures |
measures.measures_with_nutrition | no | array | List of measurements specific to this food along with the nutrition per 100 g |
measures.measures_with_nutrition.measures.amount | no | double | Number of |
measures.measures_with_nutrition.measures.measure_unit | no | enum | MEASURE_UNIT_G | MEASURE_UNIT_ML | MEASURE_UNIT_OZ | MEASURE_UNIT_FL_OZ |
measures.measures_with_nutrition.measures.nutrition_coefficient | no | double | Multiplier to use with nutrition per 100g to get nutrition of measure. It's derived from product density |
measures.measures_with_nutrition.measures.name | no | string | Localized measurement name e.g. |
measures_with_nutrition.nutrition | no | object | Wrapper object for nutrition list |
measures_with_nutrition.nutrition.nutrition | no | array | List of nutrition components |
measures_with_nutrition.nutrition.nutrition.amount | yes | double | Amount of nutrition component per 100g of the food |
measures_with_nutrition.nutrition.nutrition.unit_name | no | enum | NUTRITION_UNIT_G | NUTRITION_UNIT_MG | NUTRITION_UNIT_MKG | NUTRITION_UNIT_KCAL Macronutrients and Fiber are returned in grams Micronutrients are returned either in milligrams of micrograms Energy is returned in Kilocalories |
measures_with_nutrition.nutrition.nutrition.code | no | enum | See below |
Nutrition codes
Whisk is always trying to provide full up to date nutritional data, although all nutrition codes for food are not always available. Nutrition codes for missing data are not returned.
NUTRITION_CODE_ENERC_KCAL: Energy
NUTRITION_CODE_FAT: Total Fat
NUTRITION_CODE_FASAT: Saturated Fat
NUTRITION_CODE_CHOCDF: Carbohydrate Total
NUTRITION_CODE_SUGAR: Sugars
NUTRITION_CODE_PROCNT: Protein
NUTRITION_CODE_NA: Sodium
NUTRITION_CODE_FIBTG: Fiber
NUTRITION_CODE_FATRN: Trans Fat
NUTRITION_CODE_FAMS: Monounsaturated Fat
NUTRITION_CODE_FAPU: Polyunsaturated Fat
NUTRITION_CODE_FAT_UNSAT: Unsaturated Fat
NUTRITION_CODE_CHOLE: Cholesterol
NUTRITION_CODE_CA: Calcium
NUTRITION_CODE_MG: Magnesium
NUTRITION_CODE_K: Potassium
NUTRITION_CODE_FE: Iron
NUTRITION_CODE_ZN: Zinc
NUTRITION_CODE_P: Phosphorus
NUTRITION_CODE_VITA_RAE: Vitamin A
NUTRITION_CODE_VITC: Vitamin C
NUTRITION_CODE_THIA: Thiamin B1
NUTRITION_CODE_RIBF: Riboflavin B2
NUTRITION_CODE_NIA: Niacin B3
NUTRITION_CODE_VITB6A: Vitamin B6
NUTRITION_CODE_FOL: Folic Acid B9
NUTRITION_CODE_VITB12: Vitamin B12
NUTRITION_CODE_VITD: Vitamin D
NUTRITION_CODE_TOCPHA: Vitamin E
NUTRITION_CODE_VITK1: Vitamin K
Imperial measures
When country is specified in the request and is one of USA, UK, Canada, then Whisk API will return measures in both Metric and Imperial systems.
Measures and nutrition explained
To support volume based measures we've introduced a nutrition_coefficient
attribute. Let's see it on the following example
Whisk API returns nutrition per 100g
in metric units. It's a standard adopted all over the world including USDA and KFDA.
The response above means:
There's 60 kCal
and 3.2g
of Fat in 100g
of Milk.
The cup of milk has volume of 240 ml
or 8.11 fl oz
. The cup of milk weights 2.448
times more than 100g
of milk.
So the cup of milk has 60 * 2.448 = 146.88 kCal
and 3.2 * 2.448 = 7.8g
of Fat.
Sometimes one product may come with different attributes e.g. cooked
or fried
. Since nutrition of cooked
product is different, it will come as a separate item within measures_with_nutrition
array.
Last updated