Line 5: |
Line 5: |
| | | |
| <big>First of all, remember to do tests on https://world.openfoodfacts.net - login and password: off. | | <big>First of all, remember to do tests on https://world.openfoodfacts.net - login and password: off. |
| + | |
| + | <big>The new version of the documentation is available here: |
| + | * [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> | | </big> |
| | | |
Line 46: |
Line 50: |
| If you want to avoid coding the detection of password errors, login stuff… you can create a global account for all your users. | | If you want to avoid coding the detection of password errors, login stuff… you can create a global account for all your users. |
| | | |
− | You can create a global account to let the users of your app contribute. please name it YourApp_app or something like that, so that we can spot them easily. Better yet, introduce yourself on Slack :-) | + | You can create a global account to let the users of your app contribute. Please name it YourApp_app or something like that, so that we can spot it easily. Better yet, introduce yourself on Slack :-) |
| | | |
| == Manipulating photos for a product == | | == Manipulating photos for a product == |
Line 54: |
Line 58: |
| == 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 |
| + | <pre>{ |
| + | “status_verbose”: “no code or invalid code”, |
| + | “status”: 0 |
| + | }</pre> |
| | | |
− | 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>
| + | '''Endpoint:''' <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>
| + | '''Testing endpoint:'''<code>https://world.openfoodfacts.net/cgi/product_jqm2.pl</code> |
| | | |
| === Quick overview === | | === Quick overview === |
Line 75: |
Line 83: |
| | | |
| ==== Status after save ==== | | ==== Status after save ==== |
− | | + | <pre> |
− | * {"Status_verbose":"fields saved","status":1}
| + | { |
| + | "status_verbose": "fields saved", |
| + | "status": 1 |
| + | } |
| + | </pre> |
| | | |
| === Examples === | | === Examples === |
Line 119: |
Line 131: |
| | | |
| === Posting additional photos === | | === Posting additional photos === |
| + | '''Type:''' POST |
| + | |
| + | '''Endpoint:''' <code>/cgi/product_image_upload.pl</code> |
| + | |
| + | Fields: |
| + | * <code>code</code>: the barcode |
| + | * <code>imagefield</code>: (front | ingredients | nutrition) |
| | | |
− | * Photos post on /cgi/product_image_upload.pl
| + | Please refer to the more complete: [[API/Write/Photos]] |
− | ** Code: the barcode
| |
− | ** Imagefield: (front | ingredients | nutrition)
| |
| | | |
| ==== Add more pictures without selecting them ==== | | ==== Add more pictures without selecting them ==== |
Line 152: |
Line 169: |
| </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: | + | This '''adds''' 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&add_brands=Brand%202</nowiki></code> |
Line 427: |
Line 444: |
| | | |
| 12% wine | | 12% wine |
− | <pre>nutriment_unit=%25%20vol&nutriment_alcohol=12</pre> | + | <pre>nutriment_alcohol_unit=%25%20vol&nutriment_alcohol=12</pre> |
| | | |
| ==== Adding the carbon footprint ==== | | ==== Adding the carbon footprint ==== |