Upload Product Image
Changed onThis endpoint allows to upload an image for a product. The image is uploaded in the request body as a base64 encoded string. Optionally, it is possible to select the uploaded image for specific information (e.g. front, ingredients, nutrition, packaging) for specific languages. Each selected image is a cropped version of the uploaded image.
If the product does not exist, it will be created.
Request
- Base URLhttps://world.openfoodfacts.org
- AuthAPI key in cookie session and API key in header User-Agent
Path parameters
The barcode of the product corresponding to the image.
Request body
Example request
{
"lc": "fr",
"cc": "fr"
}Response
The response will include a "product" structure. The fields returned in this structure will depend on the value of the "fields" input field:
-
"updated" (default): all fields updated by the query will be returned, including fields that are directly generated from the updated fields. For instance, sending "packagings" or "packagings_add" will return the "packagings" field.
-
"none": no fields are returned.
-
"all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels".
The "fields" values can also be concatenated: "all,knowledge_panels"
Example response
{
"status": "success_with_errors",
"result": {
"id": "product_updated",
"name": "Product updated",
"lc_name": "Produit mis à jour"
},
"errors": [
{
"message": {
"id": "sugars_higher_than_carbohydrates",
"name": "Sugars higher than carbohydrates",
"lc_name": "Sucres plus élevés que les glucides",
"description": "Sugars (40g) are higher than carbohydrates (35g).",
"lc_description": "Les sucres (40g) sont plus élévés que les glucdes."
},
"field": {
"id": "nutriment.sugars",
"value": "40"
},
"impact": {
"id": "nutrients_not_updated",
"name": "Nutrients not updated",
"lc_name": "Nutriments non mis à jour",
"description": "The nutrients were not updated.",
"lc_description": "Les nutriments n'ont pas été mis à jour."
}
}
]
}Changes
- breaking
added to the request body
allOflist - breaking
the
allOf[subschema #2]/selectedrequest property type changed from no type toobject - breaking
the
allOf[subschema #2]/product/images/uploaded/patternProperties[(?<imgid>\d+)]response's property type changed from no type toobjectfor status
9 more changes in this revision
- breaking