Jump to content

API:Logbuch-Aktionen

From mediawiki.org
This page is a translated version of the page API:Logevents and the translation is 100% complete.
MediaWiki Version:
1.9

GET-Abfrage um eine Liste aller geloggten Aktionen zu erhalten, wie sie auf Special:Log zu sehen ist.

API-Dokumentation


list=logevents (le)

(main | query | logevents)

Get events from logs.

Specific parameters:
Other general parameters are available.
leprop

Which properties to get:

ids
Adds the ID of the log event.
title
Adds the title of the page for the log event.
type
Adds the type of log event.
user
Adds the user responsible for the log event. If the user has been revision deleted, a userhidden property will be returned.
userid
Adds the user ID who was responsible for the log event. If the user has been revision deleted, a userhidden property will be returned.
timestamp
Adds the timestamp for the log event.
comment
Adds the comment of the log event. If the comment has been revision deleted, a commenthidden property will be returned.
parsedcomment
Adds the parsed comment of the log event. If the comment has been revision deleted, a commenthidden property will be returned.
details
Lists additional details about the log event. If the log event has been revision deleted, an actionhidden property will be returned.
tags
Lists tags for the log event.
Values (separate with | or alternative): comment, details, ids, parsedcomment, tags, timestamp, title, type, user, userid
Default: ids|title|type|user|timestamp|comment|details
letype

Filter log entries to only this type.

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

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-protected-vars/*, abusefilter/create, abusefilter/hit, abusefilter/modify, abusefilterblockeddomainhit/*, abusefilterprivatedetails/access, block/block, block/reblock, block/unblock, checkuser-private-event/*, checkuser-temporary-account/*, contentmodel/change, contentmodel/new, create/create, delete/delete, delete/delete_redir, delete/delete_redir2, delete/event, delete/flow-delete-post, delete/flow-delete-topic, delete/flow-restore-post, delete/flow-restore-topic, delete/restore, delete/revision, gblblock/*, gblblock/gunblock, 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/translatable-bundle, import/upload, interwiki/*, ipinfo/*, 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, messagebundle/deletefnok, messagebundle/deletefok, messagebundle/movenok, messagebundle/moveok, move/move, move/move_redir, newsletter/*, newusers/autocreate, newusers/byemail, newusers/create, newusers/create2, newusers/forcecreatelocal, 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, translationreview/unfuzzy, upload/overwrite, upload/revert, upload/upload, urlshortener/*, usermerge/*
lestart

The timestamp to start enumerating from.

Type: timestamp (allowed formats)
leend

The timestamp to end enumerating.

Type: timestamp (allowed formats)
ledir

In which direction to enumerate:

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

Filter entries to those made by the given user.

Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
letitle

Filter entries to those related to a page.

lenamespace

Filter entries to those in the given namespace.

One of the following values: -1, -2, 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, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
leprefix

Disabled due to miser mode.

letag

Only list event entries tagged with this tag.

lelimit

How many total event entries to return.

Type: integer or max
The value must be between 1 and 500.
Default: 10
lecontinue

When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.

Beispiel

GET-Anfrage

Erhalte die drei letzten geloggten Aktionen.

Antwort

{
  "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"
      }
      ...
    ]
  }
}

Beispielcode

Python

#!/usr/bin/python3

"""
    get_logevents.py

    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"

PARAMS = {
    "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"])

PHP

<?php
/*
    get_logevents.php

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

JavaScript

/*
    get_logevents.js

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

fetch(url)
    .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);
        }
    })
    .catch(function(error){console.log(error);});

MediaWiki JS

/*
	get_logevents.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,
		l;
	for ( l in logs ) {
		console.log( 'There is ' + logs[ l ].type + ' log for page ' + logs[ l ].title );
	}
} );

Mögliche Fehler

Code Information
leparam_user Benutzername Benutzername nicht gefunden.
leparam_title Ungültiger Titel „title“.
Dies passiert, wenn du letitle auf einen ungültigen Titel setzt.
apierror-unrecognizedvalue Unrecognized value for parameter leaction: value.
apierror-prefixsearchdisabled Prefix search is disabled in Miser Mode.

Parametergeschichte

  • v1.17: Eingeführt leaction

Zusätzliche Anmerkungen

  • Dieses Modul kann nicht als Generator benutzt werden.
  • Für Einträge zu Autoblock-Entsperrungen wird der ausgegebene title als "User:$blockid" angezeigt. Dies ist keine Benutzerseite, sondern einfach die Art, auf die es gespeichert wird. Siehe task T19781.
  • Wenn die userid für die Erstellung eines Benutzerkontos spezifiziert wird, wird die userid des erstellenden Benutzers ausgegeben. Wenn es fehlt, wird die userid des erstellten Kontos ausgegeben. Siehe task T73020.
  • Siehe Manual:Log_actions für Log-Typen und Log-Aktionen, sowie ihre Log-Parameter und Einträge und Beschreibungen der Log-Suche .
  • Jede geloggte Aktion wird in der Handbuch:logging-Tabelle geloggt. Benutzer können diese Bearbeitungen auf Special:Log sehen, mit Ausnahme von ein paar beschränkten Logbüchern wie Special:Log/suppress.

Siehe auch