Products

Revert Product to Previous Revision

Changed on

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

post/api/v3/product_revert

Request

  • Base URL
    https://world.openfoodfacts.org
  • Auth
    API key in cookie session and API key in header User-Agent

Request body

fieldsstring

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_lcstring

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.

codestring

Barcode of the product

revinteger

Revision number to revert to

Example request

{
  "fields": "product_name,packagings",
  "tags_lc": "fr"
}

Response

OK

status'success' | 'success_with_warnings' | 'success_with_errors' | 'failure'

Overall status of the request: whether it failed or succeeded, with or without warnings or errors.

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 allOf list

    • warning

      removed from the request body allOf list

    • info

      added to the response body allOf list for the response status

    1 more change in this revision