Changes

Jump to navigation Jump to search
796 bytes added ,  13:36, 8 December 2022
no edit summary
Line 1: Line 1:  
[[Category:Developer]] [[Category:API]]
 
[[Category:Developer]] [[Category:API]]
 
<Back to [[API/Write]](Required reading)
 
<Back to [[API/Write]](Required reading)
 
+
<big>
 +
The new version of the documentation is available here:
 +
* [https://openfoodfacts.github.io/api-documentation/ API V2 - Comprehensive but not OpenAPI compliant] - It contains uses cases for displaying a product, and letting your users add the data required to get the Nutri-Score, the NOVA classification, additives, and the Eco-Score.
 +
* [https://openfoodfacts.github.io/openfoodfacts-server/reference/api/ API V2 - new OpenAPI documentation] - Work in Progress
 +
* [https://openfoodfacts.github.io/openfoodfacts-server/reference/api-v3/ API V3 - new OpenAPI documentation] - Work in Progress
 +
</big>
 
=== Manipulating photos for a product ===
 
=== Manipulating photos for a product ===
 
==== Understanding products and photos ====
 
==== Understanding products and photos ====
 
* Photos are the primary source of Open Food Facts.
 
* Photos are the primary source of Open Food Facts.
 
* We need good photos of the '''product''', of its '''ingredients''' and '''nutrition table'''. (and for each language present on the packaging)
 
* We need good photos of the '''product''', of its '''ingredients''' and '''nutrition table'''. (and for each language present on the packaging)
 +
* <span style="color:#d33">Good photos means a minimal allowed size: 640 x 160.</span>
 
* Please encourage your users to add as many photos as possible, even if the product is already complete (in that case, don't set them as default photos for  front, ingredients, and nutrition)
 
* Please encourage your users to add as many photos as possible, even if the product is already complete (in that case, don't set them as default photos for  front, ingredients, and nutrition)
   Line 22: Line 28:     
===== Parameters =====
 
===== Parameters =====
* code: the barcode
+
* code: the barcode of the product
* imagefield: (front | ingredients | nutrition)
+
* imagefield: (can be either: front | ingredients | nutrition)
* imgupload_front : your image file if imagefield:front
+
* imgupload_front : your image file if imagefield=front
* imgupload_ingredients: your image file if imagefield:ingredients
+
* imgupload_ingredients: your image file if imagefield=ngredients
* imgupload_nutrition: your image file if imagefield:nutrition
+
* imgupload_nutrition: your image file if imagefield=nutrition
 
      
===== Example =====
 
===== Example =====
Line 279: Line 284:  
Values:
 
Values:
 
==== Selecting a photo ====
 
==== Selecting a photo ====
<pre> https://world.openfoodfacts.net/cgi/product_image_crop.pl?code=3266110700910&id=nutrition_fr&imgid=1</pre>
+
<pre>product_image_crop.pl?code=3266110700910&id=nutrition_fr&imgid=1</pre>
 
+
<pre>
 
id: the field you want to attribute the image to
 
id: the field you want to attribute the image to
 
code: the barcode of the product
 
code: the barcode of the product
 
imgid: the image id you want to select into the field
 
imgid: the image id you want to select into the field
 +
</pre>
 +
<pre>
 +
id can be:
 +
front_fr
 +
nutrition_fr
 +
ingredients_fr
 +
 +
front_nl
 +
nutrition_nl
 +
ingredients_nl
 +
 +
 +
</pre>
 +
<pre>
 +
You retrieve the photo id when you upload it
 +
</pre>
    
==== Rotating a photo ====
 
==== Rotating a photo ====
 
<pre>Test server: https://world.openfoodfacts.net/cgi/product_image_rotate.pl</pre>
 
<pre>Test server: https://world.openfoodfacts.net/cgi/product_image_rotate.pl</pre>
<pre>Live server: https://world.openfoodfacts.org/cgi/product_image_rotate.pl</pre>
+
<pre>
 +
Parameters:
 +
</pre>
 
===== Getting the preview =====
 
===== Getting the preview =====
 
Parameters:
 
Parameters:

Navigation menu