From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page API:Logevents and the translation is 44% complete.
Other languages:
English • ‎français • ‎polski • ‎中文 • ‎日本語
Wersja MediaWiki: 1.9

GET request to fetch a list of all logged events as shown in Special:Log.

Dokumentacja API

list=logevents (le)

(main | query | logevents)

Get events from logs.


Which properties to get:

Adds the ID of the log event.
Adds the title of the page for the log event.
Adds the type of log event.
Adds the user responsible for the log event.
Adds the user ID who was responsible for the log event.
Adds the timestamp for the log event.
Adds the comment of the log event.
Adds the parsed comment of the log event.
Lists additional details about the log event.
Lists tags for the log event.
Values (separate with | or alternative): ids, title, type, user, userid, timestamp, comment, parsedcomment, details, tags
Default: ids|title|type|user|timestamp|comment|details

Filter log entries to only this type.

One of the following values: Can be empty, or spamblacklist, titleblacklist, timedmediahandler, gblblock, renameuser, globalauth, gblrights, gblrename, abusefilter, abusefilterprivatedetails, liquidthreads, massmessage, translationreview, notifytranslators, thanks, usermerge, oath, newsletter, block, protect, rights, delete, upload, move, import, patrol, merge, suppress, tag, managetags, contentmodel, pagetranslation, newusers, create, pagelang

Filter log actions to only this action. Overrides letype. In the list of possible values, values with the asterisk wildcard such as action/* can have different strings after the slash (/).

One of the following values: abusefilter/create, abusefilter/hit, abusefilter/modify, abusefilterprivatedetails/access, block/block, block/reblock, block/unblock, contentmodel/change, contentmodel/new, create/create, delete/delete, delete/delete_redir, delete/event, delete/flow-delete-post, delete/flow-delete-topic, delete/flow-restore-post, delete/flow-restore-topic, delete/restore, delete/revision, gblblock/dwhitelist, gblblock/gblock, gblblock/gblock2, gblblock/gunblock, gblblock/modify, gblblock/whitelist, gblrename/merge, gblrename/promote, gblrename/rename, gblrights/deleteset, gblrights/groupperms, gblrights/groupprms2, gblrights/groupprms3, gblrights/grouprename, gblrights/newset, gblrights/setchange, gblrights/setnewtype, gblrights/setrename, gblrights/usergroups, globalauth/delete, globalauth/hide, globalauth/lock, globalauth/lockandhid, globalauth/setstatus, globalauth/unhide, globalauth/unlock, import/interwiki, import/lqt-to-flow-topic, import/upload, interwiki/*, liquidthreads/merge, liquidthreads/move, liquidthreads/resort, liquidthreads/signatureedit, liquidthreads/split, liquidthreads/subjectedit, lock/flow-lock-topic, lock/flow-restore-topic, managetags/activate, managetags/create, managetags/deactivate, managetags/delete, massmessage/*, massmessage/failure, massmessage/send, massmessage/skipbadns, massmessage/skipnouser, massmessage/skipoptout, merge/merge, move/move, move/move_redir, newsletter/*, newusers/autocreate, newusers/byemail, newusers/create, newusers/create2, newusers/newusers, notifytranslators/sent, oath/*, pagelang/pagelang, pagetranslation/associate, pagetranslation/deletefnok, pagetranslation/deletefok, pagetranslation/deletelnok, pagetranslation/deletelok, pagetranslation/discourage, pagetranslation/dissociate, pagetranslation/encourage, pagetranslation/mark, pagetranslation/movenok, pagetranslation/moveok, pagetranslation/prioritylanguages, pagetranslation/unmark, patrol/autopatrol, patrol/patrol, protect/modify, protect/move_prot, protect/protect, protect/unprotect, renameuser/renameuser, rights/autopromote, rights/blockautopromote, rights/restoreautopromote, rights/rights, spamblacklist/*, suppress/block, suppress/cadelete, suppress/delete, suppress/event, suppress/flow-restore-post, suppress/flow-restore-topic, suppress/flow-suppress-post, suppress/flow-suppress-topic, suppress/hide-afl, suppress/reblock, suppress/revision, suppress/setstatus, suppress/unhide-afl, tag/update, thanks/*, timedmediahandler/resettranscode, titleblacklist/*, translationreview/group, translationreview/message, upload/overwrite, upload/revert, upload/upload, usermerge/*

The timestamp to start enumerating from.

Type: timestamp (allowed formats)

The timestamp to end enumerating.

Type: timestamp (allowed formats)

In which direction to enumerate:

List oldest first. Note: lestart has to be before leend.
List newest first (default). Note: lestart has to be later than leend.
One of the following values: newer, older
Default: older

Filter entries to those made by the given user.

Type: user name

Filter entries to those related to a page.


Filter entries to those in the given namespace.

One of the following values: -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 486, 487, 828, 829, 1198, 1199, 2300, 2301, 2302, 2303, 2600, 5500, 5501

Disabled due to miser mode.


Only list event entries tagged with this tag.


How many total event entries to return.

No more than 500 (5,000 for bots) allowed.
Type: integer or max
Default: 10

When more results are available, use this to continue.


Żądanie GET

Get the three most recent logevents.


  "batchcomplete": "",
  "continue": {
    "continue": "-||",
    "lecontinue": "20190606150600|99729503"
  "query": {
    "logevents": [
        "action": "create",
        "comment": "added to WikiProject (via [[WP:JWB]])",
        "logid": 99729506,
        "logpage": 60974819,
        "ns": 15,
        "pageid": 60974819,
        "params": {},
        "timestamp": "2019-06-06T15:06:07Z",
        "title": "Category talk:Electronic albums by Senegalese artists",
        "type": "create",
        "user": "Jevansen"

Przykładowy kod




    MediaWiki API Demos
    Demo of `Logevents` module: Get the three most recent logevents.

    MIT License

import requests

S = requests.Session()

URL = "https://en.wikipedia.org/w/api.php"

    "action": "query",
    "format": "json",
    "list": "logevents",
    "lelimit": "3"

R = S.get(url=URL, params=PARAMS)
DATA = R.json()

LOGS = DATA["query"]["logevents"]

for l in LOGS:
    print("There is " + l["type"] + " log for page " + l["title"])



    MediaWiki API Demos
    Demo of `Logevents` module: Get the three most recent logevents.

    MIT License

$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
    "action" => "query",
    "format" => "json",
    "list" => "logevents",
    "lelimit" => "3"

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

foreach( $result["query"]["logevents"] as $k => $v ) {
    echo( "There is " . $v["type"] . " log for page " . $v["title"] . "\n" );



    MediaWiki API Demos
    Demo of `Logevents` module: Get the three most recent logevents.

    MIT License

var url = "https://en.wikipedia.org/w/api.php"; 

var params = {
    action: "query",
    format: "json",
    list: "logevents",
    lelimit: "3"

url = url + "?origin=*";
Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});

    .then(function(response){return response.json();})
    .then(function(response) {
        var logs = response.query.logevents;
        for (var l in logs) {
            console.log("There is " + logs[l].type + " log for page " + logs[l].title);

MediaWiki JS


	MediaWiki API Demos
	Demo of `Logevents` module: Get the three most recent logevents.

	MIT License

var params = {
		action: 'query',
		format: 'json',
		list: 'logevents',
		lelimit: '3'
	api = new mw.Api();

api.get( params ).done( function ( data ) {
	var logs = data.query.logevents,
	for ( l in logs ) {
		console.log( 'There is ' + logs[ l ].type + ' log for page ' + logs[ l ].title );
} );

Possible errors

Kod Info
leparam_user User name username not found.
leparam_title Zły tytuł „title”.
This happens when you set letitle to an invalid title.
apierror-unrecognizedvalue Nierozpoznana wartość parametru leaction: value.
apierror-prefixsearchdisabled Prefix search is disabled in Miser Mode.

Parameter history

  • v1.17: Introduced leaction

Additional notes

Zobacz też