Products

Revert Product to Previous Revision

For moderators only, revert a product to a previous revision.

POST
/api/v3/product_revert

The code and rev fields are mandatory.

fields?string

Comma separated list of fields requested in the response. Special values: "updated": returns field that were updated by the query (e.g. sending "packagings" or "packagings_add" would return "packagings"), "none": returns no fields, "all": returns all fields except generated fields that need to be explicitly requested such as "knowledge_panels". Defaults to "updated" for WRITE requests, and "all" for READ requests.

tags_lc?string

2 letter language code to request names of tags in a specific language.

For READ requets: if passed, all taxonomized tags of the response will include a lc_name property with the translation in the requested language, if available. Otherwise, the property value will contain the name in the original language, prefixed by the 2 language code and a colon.

For WRITE requests: if passed, taxonomized tags fields with a lc_name property will be considered to be in this language.

code?string

Barcode of the product

rev?integer

Revision number to revert to

Response Body

curl -X POST "https://world.openfoodfacts.org/api/v3/product_revert" \
  -H "Content-Type: application/json" \
  -d '{
    "fields": "product_name,packagings",
    "tags_lc": "fr"
  }'
{
  "status_id": "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."
      }
    }
  ]
}