API:Dateirepositoriums-Info

This page is a translated version of the page API:Filerepoinfo and the translation is 100% complete.
MediaWiki Version:
1.22

Get-Abfrage, die Meta-Informationen über in dem Wiki konfigurierte Bilderrepositorien ausgibt.

API-Dokumentation


meta=filerepoinfo (fri)

(main | query | filerepoinfo)

Return meta information about image repositories configured on the wiki.

Parameter:
friprop

Which repository properties to get (properties available may vary on other wikis).

canUpload
Whether files can be uploaded to this repository, e.g. via CORS and shared authentication.
descBaseUrl
(no description)
descriptionCacheExpiry
(no description)
displayname
The human-readable name of the repository wiki.
favicon
Repository wiki's favicon URL, from $wgFavicon.
fetchDescription
Whether file description pages are fetched from this repository when viewing local file description pages.
initialCapital
Whether file names implicitly start with a capital letter.
local
Whether that repository is the local one or not.
name
The key of the repository - used in e.g. $wgForeignFileRepos and imageinfo return values.
rootUrl
Root URL path for image paths.
scriptDirUrl
Root URL path for the repository wiki's MediaWiki installation.
thumbUrl
Root URL path for thumbnail paths.
url
Public zone URL path.
Values (separate with | or alternative): canUpload, descBaseUrl, descriptionCacheExpiry, displayname, favicon, fetchDescription, initialCapital, local, name, rootUrl, scriptDirUrl, thumbUrl, url
Default: canUpload|descBaseUrl|descriptionCacheExpiry|displayname|favicon|fetchDescription|initialCapital|local|name|rootUrl|scriptDirUrl|thumbUrl|url

Beispiel

GET-Anfrage

Erhalte Informationen über Dateirepositorien.


Antwort

{
    "batchcomplete": "",
    "query": {
        "repos": [
            {
                "name": "shared",
                "displayname": "Commons",
                "url": "//upload.wikimedia.org/wikipedia/commons"
            },
            {
                "name": "local",
                "displayname": "Wikipedia",
                "url": "//upload.wikimedia.org/wikipedia/en"
            }
        ]
    }
}

Beispielcode

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 );
} );

Zusätzliche Anmerkungen

  • Parameter apiurl fehlt in MediaWiki 1.25.

Siehe auch

  • API:Fileinfo - soll diese prop in zukünftigen Versionen der MediaWiki Action API ersetzen.
  • API:Stashbildinfo - ruft Informationen über Stash-Bilder ab.
  • API:Bilder - ruft alle in eine Seite eingebundenen Bilder ab.
  • API:Info - ruft Informationen über eine Liste von Seiten ab.
  • API:Bildnutzung - findet alle Seiten, die das angegebene Bild oder die angegebenen Bilder nutzen.
  • API:Bildinfo - ruft Informationen über eine Bild-Datei oder mehrere Dateien ab.