API talk:Lists

rc_id parameter
Would it be possible to add the column 'rc_id' to the recentchanges query report? &#91;user:jldupont&#124;Jean-Lou Dupont] 14:45, 10 July 2007 (UTC)

log_id parameter
Would it be possible to add the column 'log_id' to the logevents query report? &#91;user:jldupont&#124;Jean-Lou Dupont] 14:50, 10 July 2007 (UTC)

Good idea. That way if polling every 2 minutes and a burst of 1000 changes come in, you can tell it the last id (or even unix timestamp) of the last change you received and continue polling from there, confident that you won't lose events.

LogEvents Bug for MW1.11 SVN trunk
The response XML always returns 'logid="0"' Jean-Lou Dupont 21:08, 19 July 2007 (UTC)
 * Filed a bug 10660. --Yurik 22:15, 22 July 2007 (UTC)

Taking to long
takes very long on the first load. I guess this is performance issue. Bryan Tong Minh 21:03, 10 August 2007 (UTC)
 * I think I know why: Title::makeTitle is called for *separately* for *every* title when backlinks/templatelinks/embeddedin is used in generator mode. See here. I'm gonna try to fix that now. --Catrope 18:32, 10 September 2007 (UTC)
 * Hmm, apparently that's not the problem. I'll post a list of SQL queries this request makes and have domas or another DB techie look at it. --Catrope 18:54, 10 September 2007 (UTC)
 * I imported some of those templates from Commons and ran a test request against it:


 * When I ran EXPLAIN against these queries, only the templatelinks part of the first query mentioned using an index. I don't know if that's the problem, though, so I'll ask an expert. --Catrope 19:54, 10 September 2007 (UTC)

Small bug in categorymember?
Does "categorymember" work different from the others? When I try http://en.wikipedia.org/w/api.php?format=xmlfm&action=query&list=embeddedin&eilimit=20&eititle=Template:LGBTProject it returns exactly the same results as http://en.wikipedia.org/w/api.php?format=xmlfm&action=query&list=embeddedin&eilimit=20&eititle=LGBTProject

"categorymember" doesn't seem to be the same - http://en.wikipedia.org/w/api.php?format=xmlfm&action=query&list=categorymembers&cmlimit=20&cmcategory=Category:Compositions_by_Alexander_Glazunov returns nothing, while http://en.wikipedia.org/w/api.php?format=xmlfm&action=query&list=categorymembers&cmlimit=20&cmcategory=Compositions_by_Alexander_Glazunov returns the list of articles. -- SatyrTN 20:40, 18 September 2007 (UTC)

allcategories
Is there not an "action=query&list=allcategories"? Any plans for development? -- SatyrTN 03:18, 8 December 2007 (UTC)

Request for redirect info in backlinks query
Hi,

I see that the backlinks query can already filter results depending if a backlink is a redirect or not (with blfiterredir) but I don't see a way to see in the result if backlinks are actually redirect or not. Could it be added to the API ?

I need to retrieve all backlinks (recursively through redirects), so currently I call recursively the backlinks query and the redirect query. Retrieving the 2 informations in one query would be very useful for me to speed up requests ;)

I quickly looked at the code of the backlinks query and it seems simple to do (I may be overlooking things because I don't know how the API is working) :
 * In run, call $this->addField('page_is_redirect'); if needed.
 * In extractRowInfo, add something like $vals['redirect'] = intval($row->page_is_redirect);.

--NicoV 18:06, 4 January 2008 (UTC)
 * Dude, just use  --Catrope 22:04, 4 January 2008 (UTC)

allpages and apprefix
Hi,

I am trying to use allpages with the apprefix parameter, but so far I have no results at all. Am I doing something wrong or is there a bug ?

Example: http://en.wikipedia.org/w/api.php?action=query&list=allpages&apprefix=Bal&apfrom=bal

Result: No pages at all

Edit: Also, is there a way to request all page titles containing a given word ?

--NicoV 20:06, 13 January 2008 (UTC)


 * Ok, I got the answer: http://en.wikipedia.org/w/api.php?action=query&list=allpages&apprefix=Bal
 * --NicoV 17:56, 14 January 2008 (UTC)

apprefix with namespace
Hello. I dont know if i am wrong, but we can't use namespace in prefix for the moment : I would like to know if its possible to do something like that, because over request, the title param allow to use it, and it more usefull for transwiki tools, because we dont need to encode/decode the namespace. -fr:user:bayo 19:06, 23 January 2008 (UTC)
 * http://en.wikipedia.org/w/api.php?action=query&list=allpages&apprefix=Portal:A (we can't use it)
 * http://en.wikipedia.org/w/api.php?action=query&list=allpages&apprefix=A&apnamespace=100
 * http://fr.wikipedia.org/w/api.php?action=query&bltitle=Mod%C3%A8le%3ARedirection%20jeu%20vid%C3%A9o&list=backlinks
 * It would be very hard to do. It's probably easier if you just fetched the namespace list. --Catrope 21:40, 23 February 2008 (UTC)

Fulltext Search
I would love to be able to use this, but it doesn't appear to work. The example isn't exactly functional either. 

Is this telling me that there are no articles on Wikipedia about Wikipedia?
 * Wikipedia uses the Lucene search engine, which isn't supported by the API yet. On wikis using MediaWiki's built-in search engine, list=search will work. --Catrope 21:38, 23 February 2008 (UTC)

backlinks minus transcluded templates
I'm trying I get the list of all pages that link to PAX9, but minus the pages that only link through the commmonly-transcluded w:Template:Transcription factors. Can't seem to find the right combination of parameters here to do it. Suggestions? 71.136.244.142 08:12, 29 February 2008 (UTC)
 * Just wanted to check again to see if anyone had any thoughts at all about this question. Or perhaps there is a better place to ask?  71.136.244.142 06:37, 4 March 2008 (UTC)
 * You can try the mailing listmediawiki-api--NicoV 16:01, 4 March 2008 (UTC)

embeddedin
Hello. I would like to know if its possible to order this list by pageid, like Special:WhatLinkHere work ? Sure i can do it myself, but with it for exemple we can request only smallest or biggest id. Maybe it can be something common for pagelist request. Thanks. -fr:user:bayo 12:31, 30 March 2008 (UTC)
 * Backlinks, embeddedin and imageusage are already sorted by page ID. --Catrope 13:34, 30 March 2008 (UTC)
 * That's inexact, because the display is sort by namespace (all categories are on the bottom, the id of the first one is smaller than the id of the last article). -fr:user:bayo 02:47, 2 April 2008 (UTC)
 * Better example, look at the id and the position of the namespace 102 page in this short list |Portail_jeu_vid%E9o|231830 Bayo 10:26, 14 April 2008 (UTC)

Rangeblocks
Can the API be used to find by which rangeblock an IP is blocked? --Beetstra 14:29, 10 April 2008 (UTC)
 * Not yet, I'll work on that. --Catrope 14:51, 10 April 2008 (UTC)
 * Let me expand on this. I am running unblockbot on IRC (channel #wikipedia-en-unblock).  It would be great if the api could be polled for the rangeblock, would make life for the people watching that channel much easier.  Thanks already!  --Beetstra 15:04, 10 April 2008 (UTC)
 * Similarly, but probably more difficult, autoblocks. I am not sure how they would need to be identified, but also that would be great.  Thanks again!  --Beetstra 15:13, 10 April 2008 (UTC)
 * Alright, this is where we stand now: anyone trying to unblock an IP that's part of a range block will be informed which range it's part of (you need unblock rights, though). Also, list=blocks can be used to find out whether a certain IP was autoblocked (see the  and   parameters). Looking up whether a certain IP is rangeblocked without trying to unblock it is not yet implemented, please request it here (don't forget to set Component to API) if you want it. --Catrope 14:37, 11 April 2008 (UTC)
 * Those are the functions that I already have. What I would like to have is a function to find the range in which it is, but it is merely a service to the admins who are on IRC watching the unblock requests.  They can do the same routine as you describe, but if the bot were to say which range the IP is affected by would result in less clicks and quicker unblock of the users.  I'll consider filing a request, thanks anyway.  --Beetstra 15:44, 11 April 2008 (UTC)

allcategories limited to 500
"allcategories / ac" can return at most 500 categories (MediaWiki 1.12.0). What is the recommended technique for obtaining the full category list? Maiden taiwan 17:53, 10 April 2008 (UTC)
 * Never mind, I found the answer at API:Query. Maiden taiwan 17:56, 10 April 2008 (UTC)

Eh
Not sure if this is a bug or something I miss, but it may need clarification:

When getting category information, you can use:


 * http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Requests_for_unblock
 * http://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Requests%20for%20unblock

But, when asking for the unblock info:


 * http://en.wikipedia.org/w/api.php?action=query&list=blocks&bkusers=a_a&format=xml
 * http://en.wikipedia.org/w/api.php?action=query&list=blocks&bkusers=a%20a&format=xml

then the first does not seem to work, while the second one does .. this got me puzzled for quite some time, is there something that I missed? --Beetstra 17:59, 25 April 2008 (UTC)
 * It is kind of arbitrary. The difference is that user names currently aren't rewritten (like Foo_bar is rewritten to Foo bar), I'll fix that. --Catrope 13:15, 26 April 2008 (UTC)
 * Fixed in r33908. --Catrope 15:34, 26 April 2008 (UTC)
 * Thanks! --Beetstra 14:08, 13 May 2008 (UTC)

Backlinks from Template:
Hi all, I've been trying to use the API to find backlinks: First example "What are the pages linked to Einstein" ?


 * http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitle=Albert_Einstein&bllimit=500&format=xml&blnamespace=0

OK, works fine.

Now "What are the pages using the Template:Infobox_Scientist" ? Hum, it returns no data; And (no namespace)
 * http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitle=Template:Infobox_Scientist&bllimit=500&format=xml&blnamespace=0
 * http://en.wikipedia.org/w/api.php?action=query&list=backlinks&bltitle=Template:Infobox_Scientist&bllimit=500&format=xml

returns a few 'Talks' pages. Whereas I expected much more pages: See w:en:Special:WhatLinksHere/Template:Infobox_Scientist

Is it a bug ? I'm I wrong ? Thank you for your answer --Plindenbaum 14:04, 2 July 2008 (UTC)
 * got an anwser on the mailing list, the correct url is http://en.wikipedia.org/w/api.php?action=query&list=embeddedin&eititle=Template:Infobox_Scientist --Plindenbaum 16:59, 5 August 2008 (UTC)

Articles from several categories
Is there any way to get all members of several categories with one request? I.e. I can get parameters needed for several normal pages with request like |London|York&prop=images this, but I cannot do something like |Category:London&prop=categorymembers that. As far as I know there are no parameter like "prop=categorymembers". Why not? || WASD 14:10, 17 July 2008 (UTC)
 * Getting the members of 500 categories at once is too hard on the database, unless we sort by category first, which makes it kind of useless. --Catrope 18:57, 6 September 2008 (UTC)

Watchlist bug
If I do this query: http://en.wikipedia.org/w/api.php?action=query&list=watchlist&wldir=newer&wlstart=2008-09-30T06:00:00Z&wlend=2008-09-30T12:00:00Z&wllimit=32 I get a list of articles whose most recent edit fell in that time period. About 26 with revision ID's climbing from 241956897 to 241992028. So far so good.

But if I want to see if there are articles on my watchlist that haven't been edited in a long time something odd happens. I tried to make a kind of test case: http://en.wikipedia.org/w/api.php?action=query&list=watchlist&wldir=newer&wlstart=2008-08-20T12:00:00Z&wlend=2008-08-28T12:00:00Z This should fetch articles last changed between 20 August 2008 and 28 August 2008. It turns out that I have at least one article that fits on my watchlist. (I haven't looked to see if there are more.) It was last edited on 25 August 2008 and it's revision ID is 234013275. However, an empty list is returned.

I've had a look at the source code but it just does: $this->addWhereRange('rc_timestamp', $dir, $start, $end); Which doesn't exclude the page, and neither do the other conditions as far as I can tell. Does anyone know what causes this bug? 82.139.87.239 17:08, 1 October 2008 (UTC)
 * It's technically not a bug. If you look closely, you'll see the page also disappeared from Special:Watchlist, because data about watched articles is fetched from the recentchanges table, which doesn't contain changes older than $wgRCMaxAge. Of course the full list of watched pages (also accessible through a link on Special:Watchlist) should be available through the API as well, but we already have a bug for that. --Catrope 17:57, 1 October 2008 (UTC)

That's what I'm using now: reading the full watchlist and querying the touch date etc. in small batches. But I think this should work as well, as I think things can be done more efficiently when the API implements this directly. I don't know if MySQL allows you to append tables to each other in a query, but perhaps the API could use some kind of fallback query in the case that the start timestamp is too early. Anyway, thanks for the quick reply, because I was really puzzled there for a bit. Now I know why it didn't work, I'll know when to use and when not to use the watchlist API. Thanks, 82.139.87.239 20:40, 1 October 2008 (UTC)

categorymembers expansion
from a question over at Wikipedia willage pump (technical): is is possible to tweak the categorymembers query to let 'cmstart' and 'cmend' use sort order as well as timestamps? the effect would be to get a short list of category member pages starting at page A and ending at page B according to the category sorting. this would be somewhat more meaningful than using timestamps. in fact, I'm really not sure what timestamp is being referred to here. the date the pages were last edited? the date the pages were added to the category? I suppose I could figure that out by experimenting, though... --Ludwigs2 08:33, 15 October 2008 (UTC)
 * I don't exactly know what the timestamp refers to either.  and   are parameters of type , so they don't allow other types of input. Also, changing the semantics of existing parameters would break code actually using   or   in combination with  . New parameters to start/end based on sortkey could be added, of course; they could even replace  . To get this fixed, please provide a link to the request of file a bug at BugZilla. --Catrope 14:24, 15 October 2008 (UTC)


 * ok, I've filed something over at bugzilla. --Ludwigs2 19:30, 15 October 2008 (UTC)

several key words
Hello,

How can I make a query on several key words avoiding to launch the API call each time?

I tried "action=query&list=search&srsearch=word1,_word2" but it does not work... Is it possible?

I mean I want to search the article with one of the 2 key words (or both) but not the articles with both words only.

Thank you

Hi

Use this character: | (I don't know its name) instead of comma, like

"action=query&list=search&srsearch=word1|_word2"

Winston 10:42, 13 July 2009 (UTC)

Global rights
Can I find lists of users which have global rights somewhere in the API? I don't see it. I mean queries like:

http://en.wikipedia.org/w/api.php?action=query&list=allusers&augroup=sysop&aulimit=500&format=xml

But then for global groups (global rollbacker, etc.). Thanks. --Beetstra 12:50, 24 April 2009 (UTC)
 * Don't know about you, but that sample query there returns an error for me. &mdash; Anonymous Dissident  Talk 15:11, 24 April 2009 (UTC)
 * Nope, seems to work, for clarity, I have removed the formatting -> http://en.wikipedia.org/w/api.php?action=query&list=allusers&augroup=sysop&aulimit=500 .. gives the first 500 sysops on en. --Beetstra 12:48, 25 April 2009 (UTC)

API internal error
Problem also reported on MediaWiki API mailing list : a few hours ago, some queries lead to API internal errors. For example, this query generates an internal error Exception Caught: Internal error in ApiResult::setElement: Attempting to add element backlinks=500, existing value is 500. It's related to gbllimit=max parameter : removing it or replacing it with a fixed value works. --NicoV 11:51, 28 July 2010 (UTC)

get sizes of diffs?
I wonder the best way to get sizes of diffs resulting from a usercontribs list query, sort of like the ones seen in copyright investigations (example). The sizes like (+1583) make it easy to tell large edits from small ones without having to examine them individually. The only way I can think of to get these numbers is to run multiple queries, get the parent revisions from the usercontribs, then run revision queries on the parent revisions, and compare the sizes. That seems somewhat costly and it would be good if there was a way to do it with a generator. Am I missing something? Is it worth writing an RFE? Thanks for any advice. 67.122.209.190 05:42, 28 December 2010 (UTC)

Orphan pages
Is there a way of getting a list of orphan pages better than simply list=allpages and then checking list=backlinks on each on them? - 129.255.226.253 13:49, 17 October 2013 (UTC)
 * Maybe API:Querypage with Lonelypages ? https://en.wikipedia.org/w/api.php?action=query&list=querypage&qppage=Lonelypages&qplimit=10 --NicoV (talk) 14:01, 17 October 2013 (UTC)
 * Wow, that was quick! Exactly what I wanted. Thanks - 129.255.226.253 14:07, 17 October 2013 (UTC)

More than one namespace for API query list
I figuered out that more than one namespace can be involved using pipe as delmiter, e.g. for the embeddedin API using "&einamespace=5|10". I haven't found this in the documentation. I think this applies to many API functions. Where could be an appropriate place to document this? --Cactus26 (talk) 06:44, 20 January 2014 (UTC)