API:Contributors/pl

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page API:Contributors and the translation is 8% complete.
Other languages:
Deutsch • ‎English • ‎Hausa • ‎dansk • ‎español • ‎français • ‎polski • ‎português • ‎română • ‎български • ‎русский • ‎العربية • ‎سنڌي • ‎پښتو • ‎ไทย • ‎中文 • ‎日本語 • ‎한국어
Wersja MediaWiki: 1.23

GET request to view the list of logged-in contributors and the count of anonymous contributors to a page.

API documentation


prop=contributors (pc)

(main | query | contributors)

Get the list of logged-in contributors and the count of anonymous contributors to a page.

Parameters:
pcgroup

Only include users in the given groups. Does not include implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with | or alternative): bot, sysop, interface-admin, bureaucrat, steward, accountcreator, import, transwiki, ipblock-exempt, oversight, autopatrolled, uploader, translationadmin, checkuser, flow-bot, confirmed
pcexcludegroup

Exclude users in the given groups. Does not include implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with | or alternative): bot, sysop, interface-admin, bureaucrat, steward, accountcreator, import, transwiki, ipblock-exempt, oversight, autopatrolled, uploader, translationadmin, checkuser, flow-bot, confirmed
pcrights

Only include users having the given rights. Does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with | or alternative): apihighlimits, applychangetags, autoconfirmed, autocreateaccount, autopatrol, bigdelete, block, blockemail, bot, browsearchive, changetags, createaccount, createpage, createtalk, delete, deletechangetags, deletedhistory, deletedtext, deletelogentry, deleterevision, edit, editcontentmodel, editinterface, editprotected, editmyoptions, editmyprivateinfo, editmyusercss, editmyuserjson, editmyuserjs, editmyuserjsredirect, editmywatchlist, editsemiprotected, editsitecss, editsitejson, editsitejs, editusercss, edituserjson, edituserjs, hideuser, import, importupload, ipblock-exempt, managechangetags, markbotedits, mergehistory, minoredit, move, movefile, move-categorypages, move-rootuserpages, move-subpages, nominornewtalk, noratelimit, override-export-depth, pagelang, patrol, patrolmarks, protect, purge, read, reupload, reupload-own, reupload-shared, rollback, sendemail, siteadmin, suppressionlog, suppressredirect, suppressrevision, unblockself, undelete, unwatchedpages, upload, upload_by_url, userrights, userrights-interwiki, viewmyprivateinfo, viewmywatchlist, viewsuppressed, writeapi, spamblacklistlog, tboverride, tboverride-account, titleblacklistlog, gadgets-edit, gadgets-definition-edit, transcode-reset, transcode-status, urlshortener-manage-url, urlshortener-create-url, globalblock, globalblock-whitelist, globalblock-exempt, securepoll-create-poll, renameuser, nuke, torunblocked, skipcaptcha, override-antispoof, centralauth-merge, centralauth-unmerge, centralauth-lock, centralauth-oversight, globalgrouppermissions, globalgroupmembership, centralauth-rename, centralauth-usermerge, collectionsaveasuserpage, collectionsaveascommunitypage, repoadmin, codereview-use, codereview-add-tag, codereview-remove-tag, codereview-post-comment, codereview-set-status, codereview-signoff, codereview-associate, codereview-link-user, codereview-review-own, abusefilter-modify, abusefilter-log-detail, abusefilter-view, abusefilter-log, abusefilter-privatedetails, abusefilter-privatedetails-log, abusefilter-modify-restricted, abusefilter-revert, abusefilter-view-private, abusefilter-log-private, abusefilter-hidden-log, abusefilter-hide-log, abusefilter-modify-global, lqt-split, lqt-merge, lqt-react, massmessage, translate, translate-import, translate-manage, translate-messagereview, translate-groupreview, vipsscaler-test, flow-hide, flow-lock, flow-delete, flow-suppress, flow-edit-post, flow-create-board, usermerge, mwoauthproposeconsumer, mwoauthupdateownconsumer, mwoauthmanageconsumer, mwoauthsuppress, mwoauthviewsuppressed, mwoauthviewprivate, mwoauthmanagemygrants, oathauth-enable, oathauth-api-all, oathauth-disable-for-user, oathauth-view-log, newsletter-create, newsletter-delete, newsletter-manage, newsletter-restore, checkuser, checkuser-log, autoreview, autoreviewrestore, movestable, review, stablesettings, unreviewedpages, validate, templateeditor, editeditorprotected, editextendedsemiprotected, extendedconfirmed, autoreviewprotected, viewdeletedfile, pagetranslation
Maximum number of values is 50 (500 for bots).
pcexcluderights

Exclude users having the given rights. Does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed.

Values (separate with | or alternative): apihighlimits, applychangetags, autoconfirmed, autocreateaccount, autopatrol, bigdelete, block, blockemail, bot, browsearchive, changetags, createaccount, createpage, createtalk, delete, deletechangetags, deletedhistory, deletedtext, deletelogentry, deleterevision, edit, editcontentmodel, editinterface, editprotected, editmyoptions, editmyprivateinfo, editmyusercss, editmyuserjson, editmyuserjs, editmyuserjsredirect, editmywatchlist, editsemiprotected, editsitecss, editsitejson, editsitejs, editusercss, edituserjson, edituserjs, hideuser, import, importupload, ipblock-exempt, managechangetags, markbotedits, mergehistory, minoredit, move, movefile, move-categorypages, move-rootuserpages, move-subpages, nominornewtalk, noratelimit, override-export-depth, pagelang, patrol, patrolmarks, protect, purge, read, reupload, reupload-own, reupload-shared, rollback, sendemail, siteadmin, suppressionlog, suppressredirect, suppressrevision, unblockself, undelete, unwatchedpages, upload, upload_by_url, userrights, userrights-interwiki, viewmyprivateinfo, viewmywatchlist, viewsuppressed, writeapi, spamblacklistlog, tboverride, tboverride-account, titleblacklistlog, gadgets-edit, gadgets-definition-edit, transcode-reset, transcode-status, urlshortener-manage-url, urlshortener-create-url, globalblock, globalblock-whitelist, globalblock-exempt, securepoll-create-poll, renameuser, nuke, torunblocked, skipcaptcha, override-antispoof, centralauth-merge, centralauth-unmerge, centralauth-lock, centralauth-oversight, globalgrouppermissions, globalgroupmembership, centralauth-rename, centralauth-usermerge, collectionsaveasuserpage, collectionsaveascommunitypage, repoadmin, codereview-use, codereview-add-tag, codereview-remove-tag, codereview-post-comment, codereview-set-status, codereview-signoff, codereview-associate, codereview-link-user, codereview-review-own, abusefilter-modify, abusefilter-log-detail, abusefilter-view, abusefilter-log, abusefilter-privatedetails, abusefilter-privatedetails-log, abusefilter-modify-restricted, abusefilter-revert, abusefilter-view-private, abusefilter-log-private, abusefilter-hidden-log, abusefilter-hide-log, abusefilter-modify-global, lqt-split, lqt-merge, lqt-react, massmessage, translate, translate-import, translate-manage, translate-messagereview, translate-groupreview, vipsscaler-test, flow-hide, flow-lock, flow-delete, flow-suppress, flow-edit-post, flow-create-board, usermerge, mwoauthproposeconsumer, mwoauthupdateownconsumer, mwoauthmanageconsumer, mwoauthsuppress, mwoauthviewsuppressed, mwoauthviewprivate, mwoauthmanagemygrants, oathauth-enable, oathauth-api-all, oathauth-disable-for-user, oathauth-view-log, newsletter-create, newsletter-delete, newsletter-manage, newsletter-restore, checkuser, checkuser-log, autoreview, autoreviewrestore, movestable, review, stablesettings, unreviewedpages, validate, templateeditor, editeditorprotected, editextendedsemiprotected, extendedconfirmed, autoreviewprotected, viewdeletedfile, pagetranslation
Maximum number of values is 50 (500 for bots).
pclimit

How many contributors to return.

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

When more results are available, use this to continue.

Example:
Show contributors to the page Main Page.
api.php?action=query&prop=contributors&titles=Main_Page [open in sandbox]

Przykład

GET request

GET request to view the logged-in and anonymous contributors to a page.

Response

{
    "continue": {
        "pccontinue": "323710|1591",
        "continue": "||"
    },
    "query": {
        "pages": {
            "323710": {
                "pageid": 323710,
                "ns": 0,
                "title": "MediaWiki",
                "anoncontributors": 603,
                "contributors": [
                    {
                        "userid": 1,
                        "name": "Damian Yerrick"
                    },
                    {
                        "userid": 11,
                        "name": "Kpjas"
                    },
                    {
                        "userid": 43,
                        "name": "Lee Daniel Crocker"
                    },
                    ...
                ]
            }
        }
    }
}

Sample code

Python

#!/usr/bin/python3

"""
    get_contributors.py

    MediaWiki API Demos
    Demo of `Contributors` module: List all the logged-in contributors and count of anonymous 
    contributors to a page.

    MIT License
"""

import requests

S = requests.Session()

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

import requests

S = requests.Session()

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

PARAMS = {
    "action": "query",
    "titles": "MediaWiki",
    "prop": "contributors",
    "format": "json"
}

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

print(DATA)

PHP

<?php
/*
    get_contributors.php

    MediaWiki API Demos
    Demo of `Contributors` module: List all the logged-in contributors and count of anonymous 
    contributors to a page.

    MIT License
*/

$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
    "action" => "query",
    "titles" => "MediaWiki",
    "prop" => "contributors",
    "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

/*
    get_contributors.js

    MediaWiki API Demos
    Demo of `Contributors` module: Get request to list all logged-in contributors and count of anonymous contributors to a page.

    MIT License
*/

const fetch = require('node-fetch');
var url = "https://en.wikipedia.org/w/api.php"; 

var params = {
    action: "query",
    titles: "MediaWiki",
    prop: "contributors",
    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) {
        var pages = response.query.pages;
        for (var page in pages) {
            console.log(pages[page].anoncontributors);
            console.log(pages[page].contributors);
        }    
    })
    .catch(function(error){console.log(error);});

MediaWiki JS

/*
	get_contributors.js

	MediaWiki API Demos
	Demo of `Contributors` module: List all the logged-in contributors and count of anonymous 
        contributors to a page.
	MIT License
*/

var params = {
		action: 'query',
		titles: 'MediaWiki',
		prop: 'contributors',
		format: 'json'
	},
	api = new mw.Api();

api.get( params ).done( function ( data ) {
	console.log( data );
} );

Additional notes

See also

  • API:Users - to view information about a list of users.