API:Users
Jump to navigation
Jump to search
| This page is part of the MediaWiki Action API documentation. |
| Please help improve this technical documentation! Take our MediaWiki Action API Technical Documentation User Feedback Survey before 6 January – Note: The survey uses Google Forms. See Privacy Statement – Thanks! |
| Users | ||
|---|---|---|
This module cannot be used as a Generator. |
||
| Prefix | us | |
| Required rights | none | |
| Post only? | No | |
| Generated help | Current | |
| Version added |
|
|
Get information about a list of users. This module cannot be used as a generator. This module is implemented by ApiQueryUserInfo.php.
Parameters[edit]
ususers: A list of user names to get information forususerids: A list of user IDs to get information for 1.29+ustoken: Which tokens to get 1.16+ (deprecated in 1.24)userrights: Token for changing a user's group membership
usprop: Which properties to get (Default: none)blockinfo: Whether the user is blocked, by whom and whygroups: All groups the user belongs toimplicitgroups: All groups a user is automatically a member of 1.18+rights: All rights the user has 1.17+editcount: The number of edits the user has maderegistration: The time and date the user registered at 1.13+emailable: Whether the user can and wants to receive e-mail through Special:Emailuser. "emailable" element: if it is missing - user cannot be emailed, if it is present and is an empty string: user can be emailed 1.14+gender: Tags the gender of the user. Returns "male", "female", or "unknown" 1.16+
Example[edit]
Getting information about a list of users
api.php? action=query& list=users& ususers=1.2.3.4|Catrope|Vandal01|Bob& usprop=blockinfo|groups|editcount|registration|emailable|gender [try in ApiSandbox]
| Result |
|---|
{
"batchcomplete": "",
"query": {
"users": [
{
"name": "1.2.3.4",
"invalid": ""
},
{
"userid": 4587601,
"name": "Catrope",
"editcount": 359,
"registration": "2007-06-07T16:36:03Z",
"groups": [
"*",
"user",
"autoconfirmed"
],
"emailable": "",
"gender": "male"
},
{
"name": "Vandal01",
"missing": ""
},
{
"userid": 2793024,
"name": "Bob",
"editcount": 4542,
"registration": "2006-11-18T21:55:03Z",
"groups": [
"extendedconfirmed",
"reviewer",
"*",
"user",
"autoconfirmed"
],
"emailable": "",
"gender": "male"
}
]
}
}
|
Error Codes[edit]
None
| The following documentation is the output of Special:ApiHelp/query+users, automatically generated by the pre-release version of MediaWiki that is running on this site (MediaWiki.org). |
list=users (us)
- This module requires read rights.
- Source: MediaWiki
- License: GPL-2.0-or-later
Get information about a list of users.
Parameters:
- usprop
Which pieces of information to include:
- blockinfo
- Tags if the user is blocked, by whom, and for what reason.
- groups
- Lists all the groups each user belongs to.
- groupmemberships
- Lists groups that each user has been explicitly assigned to, including the expiry date of each group membership.
- implicitgroups
- Lists all the groups a user is automatically a member of.
- rights
- Lists all the rights each user has.
- editcount
- Adds the user's edit count.
- registration
- Adds the user's registration timestamp.
- emailable
- Tags if the user can and wants to receive email through Special:Emailuser.
- gender
- Tags the gender of the user. Returns "male", "female", or "unknown".
- centralids
- Adds the central IDs and attachment status for the user.
- cancreate
- Indicates whether an account for valid but unregistered usernames can be created.
- Values (separate with | or alternative): blockinfo, groups, groupmemberships, implicitgroups, rights, editcount, registration, emailable, gender, centralids, cancreate
- usattachedwiki
With usprop=centralids, indicate whether the user is attached with the wiki identified by this ID.
- ususers
A list of users to obtain information for.
- Separate values with | or alternative. Maximum number of values is 50 (500 for bots).
- ususerids
A list of user IDs to obtain information for.
- Type: list of integers
- Separate values with | or alternative. Maximum number of values is 50 (500 for bots).
- ustoken
- Deprecated.
Use action=query&meta=tokens instead.
- Values (separate with | or alternative): userrights
Example:
- Return information for user Example.
- api.php?action=query&list=users&ususers=Example&usprop=groups|editcount|gender [open in sandbox]