Jump to content

API/Write: Difference between revisions

460 bytes added ,  21 April 2019
+add_ doesn't delete previous values
(+add_ doesn't delete previous values)
Line 3: Line 3:


== WRITE API Documentation ==
== WRITE API Documentation ==
=== Status Codes ===
=== Status Codes ===
==== If the edit was successful ====
==== If the edit was successful ====
<pre>
<pre>
Line 13: Line 15:
   
   
Example: https://world.openfoodfacts.org/cgi/product_jqm2.pl?code=0048151623426&user_id=usernameexample&password=*****&product_name=KIRI%2
Example: https://world.openfoodfacts.org/cgi/product_jqm2.pl?code=0048151623426&user_id=usernameexample&password=*****&product_name=KIRI%2


=== Authentification ===
=== Authentification ===
Line 79: Line 82:


=== Editing an existing product ===
=== Editing an existing product ===
==== Posting additional photos ====
==== Posting additional photos ====
* Photos post on /cgi/product_image_upload.pl
* Photos post on /cgi/product_image_upload.pl
Line 96: Line 100:


==== Editing the product ====
==== Editing the product ====
===== Adding values to a field that's already filled =====
 
You just have to prefix add_ before the name of the field.
===== Adding values to a field that is already filled =====
You just have to prefix <code>add_</code> before the name of the field. Examples:
<pre>
<pre>
add_categories
add_categories
Line 104: Line 109:
</pre>
</pre>
This '''add''' a new value but '''doesn't delete the previous ones'''. Adding values doesn't need authentication but take it into account. Examples:
* <code><nowiki>https://world.openfoodfacts.net/cgi/product_jqm2.pl?code=0048151621226&add_brands=Brand%202</nowiki></code>
* <code><nowiki>https://world.openfoodfacts.net/cgi/product_jqm2.pl?code=0048151621226&user_id=username&password=*****&add_brands=Brand%203</nowiki></code>


==== Give the barcode ====
==== Give the barcode ====