Changes

Jump to navigation Jump to search
59 bytes added ,  20:49, 31 May 2019
no edit summary
Line 11: Line 11:  
=== If the edit was successful ===
 
=== If the edit was successful ===
   −
<code>
+
<pre>
{"status_verbose":"fields saved","status":1}
+
{
</code>
+
    ...
 +
    "status_verbose": "fields saved",
 +
    "status": 1
 +
    ...
 +
}
 +
</pre>
    
=== If there was an issue ===
 
=== If there was an issue ===
Line 24: Line 29:     
== Authentication ==
 
== Authentication ==
 
+
Fields:
* User_id
+
* user_id: string
* Password
+
* password: string
    
WARNING: If the password is not correct, the API will currently "silently" fail, both for image addition and product data addition (will return HTML 200 code + an html page with a link to login - [https://world.openfoodfacts.org/cgi/product_jqm2.pl?code=0048151623426&user_id=usernameexample&password=*****&product_name=KIRI%2 example] )
 
WARNING: If the password is not correct, the API will currently "silently" fail, both for image addition and product data addition (will return HTML 200 code + an html page with a link to login - [https://world.openfoodfacts.org/cgi/product_jqm2.pl?code=0048151623426&user_id=usernameexample&password=*****&product_name=KIRI%2 example] )
Line 34: Line 39:  
* It is possible for new products (no anonymous modification is possible though, for obvious reasons)
 
* It is possible for new products (no anonymous modification is possible though, for obvious reasons)
 
* It is possible for adding images (as many as you like)
 
* It is possible for adding images (as many as you like)
* If you detect an error 200 (wrong password), please retry the query without user_id and password. That way the contribution will be accepted. Otherwise, the photo will get lost :(
+
 
 +
If you detect an error 200 (wrong password), please retry the query without user_id and password. That way the contribution will be accepted. Otherwise, the photo will get lost :(
    
=== Global account ===
 
=== Global account ===
Line 48: Line 54:  
== Posting a new product ==
 
== Posting a new product ==
   −
Do a GET request, otherwise you'll get <code> {“status_verbose”: “no code or invalid code”,“status”: 0}</code>
+
Do a GET request, otherwise you'll get <code> {“status_verbose”: “no code or invalid code”, “status”: 0}</code>
   −
URL: <pre>https://world.openfoodfacts.org/cgi/product_jqm2.pl</pre> (Product post)<sup>(remember to do tests on world.openfoodfacts.net - login and password: off )</sup>
+
URL: <code>https://world.openfoodfacts.org/cgi/product_jqm2.pl</code> (Product post)<sup>(remember to do tests on world.openfoodfacts.net - login and password: "off")</sup>
    
URL for your tests : <pre>https://world.openfoodfacts.net/cgi/product_jqm2.pl</pre>
 
URL for your tests : <pre>https://world.openfoodfacts.net/cgi/product_jqm2.pl</pre>
Line 72: Line 78:  
* {"Status_verbose":"fields saved","status":1}
 
* {"Status_verbose":"fields saved","status":1}
   −
=== Example ===
+
=== Examples ===
    
<sup>(remember to do tests on world.openfoodfacts.net - login and password: off)</sup>
 
<sup>(remember to do tests on world.openfoodfacts.net - login and password: off)</sup>
Line 78: Line 84:  
==== Query 1 : Unauthentified query ====
 
==== Query 1 : Unauthentified query ====
   −
<pre>https://world.openfoodfacts.net/cgi/product_jqm2.pl?code=0048151623426&product_name=Maryland%20Choc%20Chip&quantity=230g&brands=Golden%20Cookies&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>
 +
https://world.openfoodfacts.net/cgi/product_jqm2.pl?code=0048151623426&product_name=Maryland%20Choc%20Chip&quantity=230g&brands=Golden%20Cookies&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 ====
Line 84: Line 92:  
<pre>https://uk.openfoodfacts.net/product/0072417136160/maryland-choc-chip</pre>
 
<pre>https://uk.openfoodfacts.net/product/0072417136160/maryland-choc-chip</pre>
   −
==== Query 2 : Authentified query ====
+
==== Query 2 : Authenticated query ====
   −
<pre>https://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>
+
<pre>
 +
https://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 ====
72

edits

Navigation menu