![]() | This page is part of theMediaWiki Action API documentation. |
MediaWiki Action API |
---|
Basics |
Authentication |
Accounts and Users |
Page Operations |
|
Search |
Developer Utilities |
Tutorials |
v·d·e |
MediaWiki version: | ≥ 1.11 |
GET request to return information about the currently logged-in user.
![]() | The following documentation is the output ofSpecial: |
Get information about the current user.
Which pieces of information to include:
Accept-Language
header sent by the client in a structured format.Withuiprop=centralids, indicate whether the user is attached with the wiki identified by this ID.
{"batchcomplete":"","query":{"userinfo":{"id":37494596,"name":"Zaycodes","groups":["*","user"],"rights":["createaccount","read","edit","createtalk","writeapi","viewmywatchlist","editmywatchlist","viewmyprivateinfo","editmyprivateinfo",...]}}
#!/usr/bin/python3""" userinfo.py MediaWiki API Demos Demo of `Userinfo` module: Get general user info and user rights MIT License"""importrequestsS=requests.Session()URL="https://en.wikipedia.org/w/api.php"PARAMS={"action":"query","meta":"userinfo","uiprop":"rights","format":"json"}R=S.get(url=URL,params=PARAMS)DATA=R.json()print(DATA)
<?php/* userinfo.php MediaWiki API Demos Demo of `Userinfo` module: Get general user info and user rights MIT License*/$endPoint="https://en.wikipedia.org/w/api.php";$params=["action"=>"query","meta"=>"userinfo","uiprop"=>"rights","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);
/* userinfo.js MediaWiki API Demos Demo of `Userinfo` module: Get general user info and user rights MIT License*/varurl="https://en.wikipedia.org/w/api.php";varparams={action:"query",meta:"userinfo",uiprop:"rights",format:"json"};url=url+"?origin=*";Object.keys(params).forEach(function(key){url+="&"+key+"="+params[key];});fetch(url).then(function(response){returnresponse.json();}).then(function(response){console.log(response);}).catch(function(error){console.log(error);});
/*userinfo.jsMediaWiki API DemosDemo of `Userinfo` module: Get general user info and user rightsMIT License*/varparams={action:'query',meta:'userinfo',uiprop:'rights',format:'json'};varapi=newmw.Api();api.get(params).then(function(data){console.log(data);});
latestcontrib
unreadcount
implicitgroups
,registrationdate
,realname
acceptlang
changeablegroups
email
preferencestoken
ratelimits
,editcount
userinfo
function is located atApiQueryUserInfo.php.