212
edits
No edit summary |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
<Back to [[API/Read]](Required reading) | <Back to [[API/Read]](Required reading) | ||
'''IMPORTANT NOTE: this page might not be up-to-date, please refer to [https://openfoodfacts.github.io/openfoodfacts-server/api/ OFFICIAL DOCUMENTATION]''' | |||
'''Please send a | |||
* e.g. | '''Please send a User-Agent HTTP Header with the name of the app/service querying, the version, system and a url if you have one''', so that you are not blocked by mistake* | ||
* e.g. User-Agent: CoolFoodApp - Android - Version 1.0 - https://coolfoodapp.com | |||
=== Reading a product === | === Reading a product === | ||
Line 327: | Line 329: | ||
* key_100g (string) - the standardized value of a serving of 100g (100ml) for type key (eg in json: "salt_100g":"0.19"); | * key_100g (string) - the standardized value of a serving of 100g (100ml) for type key (eg in json: "salt_100g":"0.19"); | ||
* key_unit (string) - the units used in the other fields (eg in json: "carbohydrates_unit":"g"). Possible values are "kg", "g", "mg, "µg", "l", "ml", "%" or ""; | * key_unit (string) - the units used in the other fields (eg in json: "carbohydrates_unit":"g"). Possible values are "kg", "g", "mg, "µg", "l", "ml", "%" or ""; | ||
* key_label (string) - a more user friendly text explaining the | * key_label (string) - a more user friendly text explaining the label | ||
Only the nutrition facts that are actually found on the packaging are present in the interface. | Only the nutrition facts that are actually found on the packaging are present in the interface. | ||
Notes: | Notes: | ||
* | * The API returns all values in grams. This applies to both the key_100g and key_serving values. | ||
* | * The API always returns the energy values in kJ by default. Multiply the value by 0.23900573614 to convert it to Calories. | ||
* | * Any nutriments submitted to OFF as % DV values are converted to grams before being stored in the database. The conversion is done based on the values [https://github.com/openfoodfacts/openfoodfacts-server/blob/master/lib/ProductOpener/Food.pm here]. Thus, the conversion rates can be used again to change the nutriment values from grams back to % DV. | ||
====== List of nutrition keys ====== | ====== List of nutrition keys ====== |
edits