API:FicherArchiver/fr
Appearance
Cette page fait partie de la documentation de l'API MediaWiki Action. |
Version de MediaWiki : | ≥ 1.17 |
Requête GET pour énumérer tous les fichiers supprimés, séquentiellement dans la table filearchive .
Documentation de l'API
Exemple
Requête GET
Fournit une liste de tous les fichiers supprimés.
Réponse
{
"batchcomplete": "",
"continue": {
"facontinue": "0000007.jpg|20070128133944|288",
"continue": "-||"
},
"query": {
"filearchive": [
{
"id": 1778,
"name": "!notedit.png",
"ns": 6,
"title": "File:!notedit.png",
"timestamp": "2011-04-25T13:17:47Z"
},
{
"id": 6949,
"name": "\"Twilight_at_the_pond\"_by_A.A.Tutunov_(1976).jpg",
"ns": 6,
"title": "File:\"Twilight at the pond\" by A.A.Tutunov (1976).jpg",
"timestamp": "2019-01-26T11:48:52Z"
},
{
"id": 5814,
"name": "---C--temp-Regelwerk.pdf",
"ns": 6,
"title": "File:---C--temp-Regelwerk.pdf",
"timestamp": "2017-03-09T10:09:24Z"
},
...
]
}
}
Exemple de code
Python
#!/usr/bin/python3
"""
file_archive.py
MediaWiki API Demos
Demo of `Filearchive` module: Get a list of all deleted files.
MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"action": "query",
"list": "filearchive",
"format": "json"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)
PHP
<?php
/*
file_archive.php
MediaWiki API Demos
Demo of `Filearchive` module: Get a list of all deleted files.
MIT License
*/
$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
"action" => "query",
"list" => "filearchive",
"format" => "json"
];
$url = $endPoint . "?" . http_build_query( $params );
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );
$result = json_decode( $output, true );
var_dump( $result );
JavaScript
/*
file_archive.js
MediaWiki API Demos
Demo of `Filearchive` module: Get a list of all deleted files.
MIT License
*/
var url = "https://en.wikipedia.org/w/api.php";
var params = {
action: "query",
list: "filearchive",
format: "json"
};
url = url + "?origin=*";
Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});
fetch(url)
.then(function(response){return response.json();})
.then(function(response) {console.log(response);})
.catch(function(error){console.log(error);});
MediaWiki JS
/*
file_archive.js
MediaWiki API Demos
Demo of `Filearchive` module: Get a list of all deleted files.
MIT License
*/
var params = {
action: 'query',
list: 'filearchive',
format: 'json'
},
api = new mw.Api();
api.get( params ).done( function ( data ) {
console.log( data );
} );
Erreurs possibles
Code | Info |
---|---|
cantview-deleted-description | Vous n’avez pas le droit d’afficher les descriptions des fichiers supprimés. |
cantview-deleted-metadata | Vous n’avez pas le droit d’afficher les métadonnées des fichiers supprimés. |
invalidsha1hash | Le hachage SHA1 fourni n’est pas valide. |
invalidsha1base36hash | Le hachage SHA1Base36 fourni n’est pas valide. |
Historique des paramètres
- v1.20: ajouté
facontinue
,mediatype
,archivename
- v1.18: ajouté
fato
,fasha1
,fasha1base36
,parseddescription