Changes

Jump to navigation Jump to search
37 bytes added ,  18:57, 30 August 2016
m
no edit summary
Line 497: Line 497:  
* the imageupload_(front|ingredients|nutrition) name, size and data needs to be encoded in the multipart/form-data format, usually your HTTP request library will do that for you
 
* the imageupload_(front|ingredients|nutrition) name, size and data needs to be encoded in the multipart/form-data format, usually your HTTP request library will do that for you
 
* all parameters need to be passed as POST parameters, do not put some in the URL
 
* all parameters need to be passed as POST parameters, do not put some in the URL
 
+
* 0048151623426 is a random barcode used only for demonstration purpose
    
Example: <sup>(remember to do tests on world.openfoodfacts.net - login and password: off )</sup>
 
Example: <sup>(remember to do tests on world.openfoodfacts.net - login and password: off )</sup>
Line 504: Line 504:  
</pre>
 
</pre>
 
<pre>
 
<pre>
http://world.openfoodfacts.net/cgi/product_image_upload.pl?code=654345678
+
http://world.openfoodfacts.net/cgi/product_image_upload.pl?code=0048151623426
 
</pre>
 
</pre>
   Line 512: Line 512:  
* URL for your tests : <pre>http://world.openfoodfacts.net/cgi/product_jqm2.pl</pre>
 
* URL for your tests : <pre>http://world.openfoodfacts.net/cgi/product_jqm2.pl</pre>
 
==== Quick overview ====
 
==== Quick overview ====
** var foodfact = { barcode : '3073780969000', name : 'I am too lazy to do my tests on the NET domain', energy: 500, energy_unit: "kJ", weight: 282 };
+
** var foodfact = { barcode : '0048151623426', name : 'Product name', energy: 500, energy_unit: "kJ", weight: 282 };
 
** var postData = {
 
** var postData = {
 
** code        : foodfact.barcode,
 
** code        : foodfact.barcode,
Line 519: Line 519:  
** product_name : foodfact.name?foodfact.name:foodfact.shop_label,
 
** product_name : foodfact.name?foodfact.name:foodfact.shop_label,
 
** quantity    : foodfact.weight?""+foodfact.weight+" g":undefined,
 
** quantity    : foodfact.weight?""+foodfact.weight+" g":undefined,
** stores      : "Intermarché",
+
** stores      : "Walmart",
 
** nutriment_energy      :foodfact.energy,
 
** nutriment_energy      :foodfact.energy,
 
** nutriment_energy_unit :foodfact.energy_unit,
 
** nutriment_energy_unit :foodfact.energy_unit,
Line 528: Line 528:  
<sup>(remember to do tests on world.openfoodfacts.net - login and password: off)</sup><br>
 
<sup>(remember to do tests on world.openfoodfacts.net - login and password: off)</sup><br>
 
===== Query 1 =====
 
===== Query 1 =====
<pre>http://world.openfoodfacts.net/cgi/product_jqm2.pl?code=072417136160&product_name=Maryland%20Choc%20Chip&quantity=230g&nutriment_energy=450&nutriment_energy_unit=kJ&nutrition_data_per=serving&ingredients_text=Fortified%20wheat%20flour%2C%20Chocolate%20chips%20%2825%25%29%2C%20Sugar%2C%20Palm%20oil%2C%20Golden%20syrup%2C%20Whey%20and%20whey%20derivatives%20%28Milk%29%2C%20Raising%20agents%2C%20Salt%2C%20Flavouring&traces=Milk%2C+Soya%2C+Nuts%2C+Wheat</pre>
+
<pre>http://world.openfoodfacts.net/cgi/product_jqm2.pl?code=0048151623426&product_name=Maryland%20Choc%20Chip&quantity=230g&nutriment_energy=450&nutriment_energy_unit=kJ&nutrition_data_per=serving&ingredients_text=Fortified%20wheat%20flour%2C%20Chocolate%20chips%20%2825%25%29%2C%20Sugar%2C%20Palm%20oil%2C%20Golden%20syrup%2C%20Whey%20and%20whey%20derivatives%20%28Milk%29%2C%20Raising%20agents%2C%20Salt%2C%20Flavouring&traces=Milk%2C+Soya%2C+Nuts%2C+Wheat</pre>
 
===== Result 2 =====
 
===== Result 2 =====
 
<pre>http://uk.openfoodfacts.net/product/0072417136160/maryland-choc-chip</pre>
 
<pre>http://uk.openfoodfacts.net/product/0072417136160/maryland-choc-chip</pre>
    
===== Query 2 =====
 
===== Query 2 =====
<pre>http://world.openfoodfacts.org/cgi/product_jqm2.pl?code=3073780969000&user_id=usernameexample&password=*****&product_name=KIRI%20GOUTER%20280G%208%20PORTIONS&quantity=282%20g&stores=Intermarch%C3%A9&nutriment_energy=500&nutriment_energy_unit=kJ&nutrition_data_per=serving</pre>
+
<pre>http://world.openfoodfacts.org/cgi/product_jqm2.pl?code=0048151623426&user_id=usernameexample&password=*****&product_name=KIRI%20GOUTER%20280G%208%20PORTIONS&quantity=282%20g&stores=Intermarch%C3%A9&nutriment_energy=500&nutriment_energy_unit=kJ&nutrition_data_per=serving</pre>
 
===== Result 2 =====
 
===== Result 2 =====
 
<pre></pre>
 
<pre></pre>
660

edits

Navigation menu