API:Filerevert

This page is a translated version of the page API:Filerevert and the translation is 67% complete.

POST request to revert a file to an old version.

Jeton

Pour rétablir un fichier à une ancienne version, un jeton CSRF est nécessaire. Le jeton CSRF est le même pour toutes les pages, mais changes à chaque connexion. Les jetons CSRF peuvent être obtenus par l'intermédiaire de action=query&meta=tokens avec type=csrf (MW 1.24+). Pour les versions plus anciennes, vous pouvez utiliser API:Tokens (action) ou API:Info/fr pour obtenir un jeton de modification.

Paramètres

  • filename : Target filename, without the File: prefix.
  • archivename : Archive name of the revision to revert to. This should include the timestamp of the revision and the name of the file in the format: yyyyMMddhhmmss!filename. This information can be found using Imageinfo with iilimit set higher than 1. When looking at a file's page, the seconds will not be displayed; the needed archive name can be found by hovering over the older image and looking at the displayed file name. (Note that the ! will already have been urlencoded as %21.)
  • token : A CSRF token obtained as per the Tokens section, above. Take care to urlencode the trailing +\ as %2B%5C
  • comment : Upload comment.

Codes d'erreur

In addition to the usual stuff:

Code Information
missingtitle La page que vous avez spécifiée n’existe pas.
filerevert-badversion Il n’y a localement aucune version antérieure du fichier qui porte la date indiquée.

Exemple

Revert Wiki.png to the version from 15:27:40, 5 March 2011.
Résultat
{
  "filerevert": {
    "result": "Success"
  }
}


action=filerevert

(main | filerevert)
  • This module requires read rights.
  • This module requires write rights.
  • This module only accepts POST requests.
  • Source: MediaWiki
  • License: GPL-2.0-or-later

Revert a file to an old version.

Specific parameters:
Other general parameters are available.
filename

Target filename, without the File: prefix.

This parameter is required.
comment

Upload comment.

Default: (empty)
archivename

Archive name of the revision to revert to.

This parameter is required.
token

A "csrf" token retrieved from action=query&meta=tokens

This parameter is required.