Last modified: 2013-12-14 20:57:24 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T21195, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19195 - Make user IDs more readily available with the API
Make user IDs more readily available with the API
Status: NEW
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on: 32494 32496 32675 27616 27617 27708 32492 32493 32495 32497 32498
Blocks: 27810
  Show dependency treegraph
 
Reported: 2009-06-14 18:54 UTC by Gurch
Modified: 2013-12-14 20:57 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Gurch 2009-06-14 18:54:06 UTC
It would be nice if the API could supply user IDs anywhere that user names are currently an option, e.g. prop=revisions. This would allow clients to use the ID rather than the name as an identifier for the user, as can be done currently with page IDs, an advantage when dealing with large numbers of items.

Revisions by anonymous users would I believe end up with 0 as the user ID this way, which may render it unsuitable for some purposes but would certainly be OK for mine.
Comment 1 Splarka 2009-06-18 04:19:26 UTC
Per: http://toolserver.org/~amidaniel/chanlogs/%23mediawiki/20090501.txt
> <brion-meeting> user ids are an internal implementation detail which should never be needed externally, but they're not actively hidden

This has been discussed before but nobody gets around to it.
Comment 2 Splarka 2009-06-18 10:24:42 UTC
Suggestions for implementation of almost full User<->ID abstraction in API (per Roan@IRC):

    Queries

ApiQueryRevisions.php
* rvprop=user -> userid="12345" or userid="0"
* rvuserid=12345
* rvexcludeuserid=12345

ApiQueryImageInfo.php
* iiprop=user -> userid="12345" or userid="0"

ApiQueryAllimages.php
* aiprop=user -> userid="12345" or userid="0"

ApiQueryAllUsers.php
* list=allusers -> name="" id="12345" or userid="0"
* austartid=12345 <- if given a userid, possible to return sequenial users by id?

ApiQueryBlocks.php <- note, non-trivial to reference a blocked user from user ID, skip

ApiQueryDeletedrevs.php
* drprop=user -> userid="12345" or userid="0"
* druserid=12345

ApiQueryLogEvents.php
* leprop=user -> userid="12345" or userid="0"
* leuserid=12345

ApiQueryRecentChanges.php
* rcprop=user -> userid="12345" or userid="0"

ApiQueryUserContributions.php
* (any) -> userid="12345" or userid="0"
* ucuserid=12345

ApiQueryWatchlist.php
* wlprop=user -> userid="12345" or userid="0"

ApiQueryUsers.php
* list=users -> userid="12345" or skip for missing=""
* ususerids=12345

ApiQueryProtectedTitles.php
* ptprop=user -> userid="12345" or userid="0"


    Actions - should also output ID on success where applicable.

ApiRollback.php
* userid=12345

ApiBlock.php
* userid=12345

ApiUnblock.php
* userid=12345

ApiEmailUser.php
* targetid=12345 <- this might be weird.

ApiUserrights.php
* userid=12345 
Comment 3 Gurch 2009-06-23 22:22:08 UTC
(In reply to comment #1)
> Per: http://toolserver.org/~amidaniel/chanlogs/%23mediawiki/20090501.txt
> > <brion-meeting> user ids are an internal implementation detail which should never be needed externally

True, but only in the sense that page IDs and revision IDs are internal implementation details, and they're available.
Comment 4 Splarka 2009-06-24 01:28:34 UTC
(In reply to comment #3)
> > <brion-meeting> user ids are an internal implementation detail which should never be needed externally,
> True, but only in the sense that page IDs and revision IDs are internal
> implementation details, and they're available.

Not the same sense at all. Page IDs are extensively used in the UI as &curid in most recent changes links (to allow the correct page to be shown even if the page has moved since). And of course, revision IDs are used anywhere a diff or permanent link is shown. User IDs however are not used in the UI anywhere... except in some extensions, which usually involve direct requests from the user (who is generally the only one with access to this number, excluding the Special:Export trick).

So, they've just never been exposed as they are never used. There are cases where they would have been handy in the API though, such as the unfortunate case of bug 17878 (usernames that could log in, and edit, but not be blocked). For this same reason, things like move and delete can be done in the API via page IDs now (where invalid titles could not be referred to otherwise). So giving them a use, like the ability to block retroactively invalid usernames, is a good excuse to expose them.
Comment 5 Sam Reed (reedy) 2010-08-28 00:39:37 UTC
Started doing some props in r71831

ApiQueryAllUsers, ApiQueryImageInfo and ApiQueryRevisions
Comment 6 Sam Reed (reedy) 2010-08-28 01:11:47 UTC
r71834

ApiQueryDeletedrevs, ApiQueryLogEvents

r71837

ApiQueryRecentChanges.php, ApiQueryUserContributions.php, ApiQueryWatchlist.php
Comment 7 Sam Reed (reedy) 2010-08-28 01:18:39 UTC
r71838

ApiQueryAllImages, ApiQueryProtectedTitles

Leaves:

    Queries

ApiQueryRevisions.php
* rvuserid=12345
* rvexcludeuserid=12345

ApiQueryAllUsers.php
* austartid=12345 <- if given a userid, possible to return sequenial users by
id?

ApiQueryDeletedrevs.php
* druserid=12345

ApiQueryLogEvents.php
* leuserid=12345

ApiQueryUserContributions.php
* ucuserid=12345

ApiQueryUsers.php
* list=users -> userid="12345" or skip for missing=""
* ususerids=12345

    Actions - should also output ID on success where applicable.

ApiRollback.php
* userid=12345

ApiBlock.php
* userid=12345

ApiUnblock.php
* userid=12345

ApiEmailUser.php
* targetid=12345 <- this might be weird.

ApiUserrights.php
* userid=12345
Comment 8 db [inactive,noenotif] 2011-02-06 19:28:30 UTC
ApiQueryFilearchive.php is missing.
Comment 9 db [inactive,noenotif] 2011-02-21 18:43:46 UTC
bug 27616

(In reply to comment #8)
> ApiQueryFilearchive.php is missing.

bug 27617
Comment 10 Sam Reed (reedy) 2011-02-21 19:50:14 UTC
QueryBlocks (Both blocking and blocked id) in r82570 / bug 27616
Comment 11 db [inactive,noenotif] 2011-02-24 18:48:01 UTC
list=users&usprop=blockinfo and list=allusers&auprop=blockinfo gives the username of the blocker. What about adding the user id of the blocker?
Comment 12 db [inactive,noenotif] 2011-02-24 19:02:15 UTC
(In reply to comment #11)
> list=users&usprop=blockinfo and list=allusers&auprop=blockinfo gives the
> username of the blocker. What about adding the user id of the blocker?

meta=userinfo&uiprop=blockinfo also
Comment 13 charitwo 2011-03-05 09:20:56 UTC
reedy spamming my inbox
Comment 14 Umherirrender 2012-04-21 19:17:12 UTC
(In reply to comment #11)
> list=users&usprop=blockinfo and list=allusers&auprop=blockinfo gives the
> username of the blocker. What about adding the user id of the blocker?

(In reply to comment #12)
> (In reply to comment #11)
> > list=users&usprop=blockinfo and list=allusers&auprop=blockinfo gives the
> > username of the blocker. What about adding the user id of the blocker?
> meta=userinfo&uiprop=blockinfo also

I add some user ids to output with Gerrit change #5546

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links