API:Filerevert/it: Difference between revisions
Appearance
Content deleted Content added
Sabrina83IT (talk | contribs) Created page with "==Parametri==" |
Sabrina83IT (talk | contribs) Created page with "Carica commento." |
||
| Line 24: | Line 24: | ||
*{{ApiParam|archivename|description=<span lang="en" dir="ltr" class="mw-content-ltr">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: <kbd>yyyyMMddhhmmss!''filename''</kbd>. This information can be found using [[API:Imageinfo|Imageinfo]] with <code>iilimit</code> 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.)</span>|required=1}} |
*{{ApiParam|archivename|description=<span lang="en" dir="ltr" class="mw-content-ltr">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: <kbd>yyyyMMddhhmmss!''filename''</kbd>. This information can be found using [[API:Imageinfo|Imageinfo]] with <code>iilimit</code> 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.)</span>|required=1}} |
||
*{{ApiParam|token|description=<span lang="en" dir="ltr" class="mw-content-ltr">A CSRF token obtained as per the [[#Tokens|Tokens]] section, above. Take care to urlencode the trailing <code>+\</code> as <code>%2B%5C</code></span>|required=1}} |
*{{ApiParam|token|description=<span lang="en" dir="ltr" class="mw-content-ltr">A CSRF token obtained as per the [[#Tokens|Tokens]] section, above. Take care to urlencode the trailing <code>+\</code> as <code>%2B%5C</code></span>|required=1}} |
||
*{{ApiParam|comment|description= |
*{{ApiParam|comment|description=Carica commento.}} |
||
<div lang="en" dir="ltr" class="mw-content-ltr"> |
<div lang="en" dir="ltr" class="mw-content-ltr"> |
||
Revision as of 16:00, 16 July 2025
| Questa pagina fa parte della documentazione MediaWiki API. |
| Filerevert | ||
|---|---|---|
| Revert a file to an old version. Questi modulo non può essere utilizzato come generatore. | ||
| Prefisso | nessuno | |
| Required rights | edit, upload | |
| Solo post? | Sì | |
| Aiuto generato | Attuale | |
| Versione aggiunta |
| |
POST request to revert a file to an old version.
Token
To revert a file to an older version, a CSRF token is required.
The CSRF token is the same for all pages, but changes at every login.
CSRF tokens can be obtained via action=query&meta=tokens with type=csrf (MW 1.24+).
For older versions, you can use API:Tokens (action) or API:Info to get an edit token.
Parametri
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 withiilimitset 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%5Ccomment: Carica commento.
Error Codes
In addition to the usual stuff:
| Code | Info |
|---|---|
| missingtitle | The page you specified doesn't exist. |
| filerevert-badversion | Non esistono versioni locali precedenti del file con il timestamp richiesto. |
Example
Revert Wiki.png to the version from 15:27:40, 5 March 2011.
api.php? action=filerevert& filename=Wiki.png& comment=Revert& archivename=20110305152740!Wiki.png& token=0123456789012345678901234567890123456789%2b%5c [prova in ApiSandbox]
| Risultato |
|---|
{
"filerevert": {
"result": "Success"
}
}
|
| The following documentation is the output of Special: |
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.
Example:
- Revert Wiki.png to the version of 2011-03-05T15:27:40Z.
- api.php?action=filerevert&filename=Wiki.png&comment=Revert&archivename=20110305152740!Wiki.png&token=123ABC [open in sandbox]