Line 1: |
Line 1: |
| + | [[Category:Developer]] [[Category:API]] |
| + | <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 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 === |
| The requested subdomain will be the locale fetched. (fr.openfoodfacts will fetch FR, world.openfoodfacts EN, world-fr FR products from the whole world) | | The requested subdomain will be the locale fetched. (fr.openfoodfacts will fetch FR, world.openfoodfacts EN, world-fr FR products from the whole world) |
Line 56: |
Line 65: |
| | | |
| ==== Product images ==== | | ==== Product images ==== |
| + | https://world.openfoodfacts.org/api/v0/product/3302749508029.json?fields=images |
| * Images ensure the reliability of Open Food Facts data. It provides a primary source and proof of all the structured data. You may therefore want to display it along the structured information. | | * Images ensure the reliability of Open Food Facts data. It provides a primary source and proof of all the structured data. You may therefore want to display it along the structured information. |
| * We encourage you to let your users upload images for products that don't exist yet, and for existing products as well (packaging and information changes over time). | | * We encourage you to let your users upload images for products that don't exist yet, and for existing products as well (packaging and information changes over time). |
Line 241: |
Line 251: |
| <pre>"amino_acids_tags":["en:l-tryptophan"]</pre> | | <pre>"amino_acids_tags":["en:l-tryptophan"]</pre> |
| | | |
− | ====== Other nutritional substances ===== | + | ====== Other nutritional substances ====== |
− | <pre>"other_nutritional_substances_tags":["en:taurine","en:inositol","en:choline-citrate","en:taurine","en:inositol","en:choline-citrate","en:taurine","en:inositol","en:choline-citrate"]<pre> | + | <pre> |
| + | "other_nutritional_substances_tags":["en:taurine","en:inositol","en:choline-citrate","en:taurine","en:inositol","en:choline-citrate","en:taurine","en:inositol","en:choline-citrate"] |
| + | </pre> |
| | | |
| ===== Palm Oil Detection ===== | | ===== Palm Oil Detection ===== |
Line 317: |
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: |
| + | * 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 ====== |
Line 430: |
Line 447: |
| "nutrition_grade_fr":"d" | | "nutrition_grade_fr":"d" |
| </pre> | | </pre> |
| + | |
| ====== Nutrition Grade Images ====== | | ====== Nutrition Grade Images ====== |
| No formal API is available, but you can use: | | No formal API is available, but you can use: |
Line 450: |
Line 468: |
| * https://world.openfoodfacts.org/nutrition-grade/unknown.json | | * https://world.openfoodfacts.org/nutrition-grade/unknown.json |
| * https://world.openfoodfacts.org/nutrition-grade/unknown.xml | | * https://world.openfoodfacts.org/nutrition-grade/unknown.xml |
| + | |
| + | |
| + | ===== Nova Groups ===== |
| + | ====== Nova Groups Images ====== |
| + | No formal API is available, but you can use: |
| + | <pre> |
| + | * https://static.openfoodfacts.org/images/misc/nova-group-4.svg |
| + | * https://static.openfoodfacts.org/images/misc/nova-group-3.svg |
| + | * https://static.openfoodfacts.org/images/misc/nova-group-2.svg |
| + | * https://static.openfoodfacts.org/images/misc/nova-group-1.svg |
| + | </pre> |
| | | |
| ===== Nutrients levels ===== | | ===== Nutrients levels ===== |