API talk:Usercontribs
From MediaWiki.org
Just new pages [edit]
How to create list of pages which was created by user (just contributions with flag new="")? --BaseBot (talk) 20:46, 1 June 2012 (UTC)
- I don't think you can. You can get the flags by using "ucprop=flags", but then you'll have to filter your result to just select those with flag "new". --R'n'B (talk) 16:51, 2 June 2012 (UTC)
uccontinue? [edit]
I'm a little baffled about the usage of uccontinue. In what way does this allow me to continue to grab more data when it's available? For example, I was trying to retrieve all of a user's past revision ids (more than 500). Other than copying and pasting the ucstart given at the bottom of the result into the url and going to that page as well, I can't figure out how uccontinue works. Could there be a little more detail on uccontinue usage somewhere? Might be a silly question, but I'd appreciate the help! RachulAdmas (talk) 19:45, 25 July 2012 (UTC)
- Hi. There is more info on this at API:Query#Continuing queries. --R'n'B (talk) 21:16, 25 July 2012 (UTC)
- Thanks for the response! It's just that it looks like uccontribs can't be used as a generator, so I'm unsure of how to keep grabbing data when there's more (like when there's more than 500 revisions). How should I go about continuing the query when I can't use uccontribs as a generator? Thanks again for the help, and if there's a more appropriate place for me to be posting questions, just let me know! RachulAdmas (talk) 14:50, 26 July 2012 (UTC)
- Well, you can continue a query even without using a generator. Look at the example on API:Usercontribs -- api.php?action=query&list=usercontribs&ucuser=Catrope&uclimit=3&ucdir=newer gives you a "query" element that contains a "usercontribs" element that contains three revision items, and also a "query-continue" element that contains a "usercontribs" element with a "ucstart" value. You need to add this "ucstart" key/value pair to your query string and submit it again to get the next 3 revisions (of course, in a real application, you probably would use a higher limit than 3). --R'n'B (talk) 15:08, 1 August 2012 (UTC)
- P.S. I don't know why the API is still using "ucstart" instead of "uccontinue". A best practice for programming this would be to take whatever key is contained in the "<query-continue><usercontribs>" element and add it to your query string; that way, if the API is changed to use a different key, your program won't break. --R'n'B (talk) 15:14, 1 August 2012 (UTC)
- Thanks for the response! It's just that it looks like uccontribs can't be used as a generator, so I'm unsure of how to keep grabbing data when there's more (like when there's more than 500 revisions). How should I go about continuing the query when I can't use uccontribs as a generator? Thanks again for the help, and if there's a more appropriate place for me to be posting questions, just let me know! RachulAdmas (talk) 14:50, 26 July 2012 (UTC)