| This page is part of the MediaWiki Action API documentation. | 
| MediaWiki version: | ≥ 1.22  | 
Get request that returns meta information about image repositories configured on the wiki.
API documentation
 Special:ApiHelp/query+filerepoinfo  | 
Example
GET request
Get information about file repositories.
Response
{
    "batchcomplete": "",
    "query": {
        "repos": [
            {
                "name": "shared",
                "displayname": "Commons",
                "url": "//upload.wikimedia.org/wikipedia/commons"
            },
            {
                "name": "local",
                "displayname": "Wikipedia",
                "url": "//upload.wikimedia.org/wikipedia/en"
            }
        ]
    }
}
Sample code
Python
#!/usr/bin/python3
"""
    file_repo_info.py
    MediaWiki API Demos
    Demo of `Filerepoinfo` module: Get information about file repositories.
    MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
    "action": "query",
    "meta": "filerepoinfo",
    "format": "json",
    "friprop": "url|name|displayname"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)
PHP
<?php
/*
    file_repo_info.php
    MediaWiki API Demos
    Demo of `Filerepoinfo` module: Get information about file repositories.
    MIT License
*/
$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
    "action" => "query",
    "meta" => "filerepoinfo",
    "format" => "json",
    "friprop" => "url|name|displayname"
];
$url = $endPoint . "?" . http_build_query( $params );
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );
echo( $output );
JavaScript
/*
	file_repo_info.js
    MediaWiki API Demos
    Demo of `Filerepoinfo` module: Get information about file repositories.
    MIT License
*/
var url = "https://en.wikipedia.org/w/api.php"; 
var params = {
    action: "query",
    meta: "filerepoinfo",
    format: "json",
    friprop: "url|name|displayname"
};
request.get({ url: url, qs: params }, function(error, res, body) {
    if (error) {
        return;
    }
    console.log(body);
});
MediaWiki JS
/*
	file_repo_info.js
    MediaWiki API Demos
    Demo of `Filerepoinfo` module: Get information about file repositories.
    MIT License
*/
var params = {
    action: "query",
    meta: "filerepoinfo",
    format: "json",
    friprop: "url|name|displayname"
},
api = new mw.Api();
api.get( params ).done( function ( data ) {
console.log( data );
} );
Additional notes
apiurlparameter is missing in MediaWiki 1.25.
See also
- API:Fileinfo -  to supersede this 
propin future versions of the MediaWiki Action API. - API:Stashimageinfo - retrieves information about stashed images.
 - API:Images - retrieves all images embedded on a page.
 - API:Info - retrieves basic information about a list of pages.
 - API:Imageusage - finds all pages that use the given image or images.
 - API:Imageinfo - retrieves information about an image file or files.
 
    This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.