I don't know if others run in to this situation, but I'll throw this idea/request out there and see what folks think.
A lot of what I use the API for is for WikiProjects. As such, I'm often getting a list of pages by looking for a project template, which is on the talk page. Then I have to turn that around and get the actual articles from main-space.
So I was wondering about way to get the "switch" of a page id. The two possibilities I thought of are:
action=query&prop=info&inprop=talkid&pageids=15580374
action=query&prop=revisions&titles=Talk:Main%20Page&rvprop=mainid
Either one would take a page or set of pages and return either the talk page id or the mainspace id.
Is this something that's doable? Desired? Thoughts? --Ian
Ian Cabell schreef:
I don't know if others run in to this situation, but I'll throw this idea/request out there and see what folks think.
A lot of what I use the API for is for WikiProjects. As such, I'm often getting a list of pages by looking for a project template, which is on the talk page. Then I have to turn that around and get the actual articles from main-space.
So I was wondering about way to get the "switch" of a page id. The two possibilities I thought of are:
action=query&prop=info&inprop=talkid&pageids=15580374
action=query&prop=revisions&titles=Talk:Main%20Page&rvprop=mainid
Either one would take a page or set of pages and return either the talk page id or the mainspace id.
Is this something that's doable? Desired? Thoughts?
The inprop=talkid suggestion sounds doable, I'll implement that soon.
Roan Kattouw (Catrope)
Would that be reversable? where inprop=talkid would return the talk page id if the page given is a main page, and inprop=mainid would return the main page if a talk page is given?
The other question that comes to mind is - would this work in other spaces? Like template-space or category-space?
Thanks! --Ian
On Sun, Mar 16, 2008 at 11:30 AM, Roan Kattouw roan.kattouw@home.nl wrote:
Ian Cabell schreef:
I don't know if others run in to this situation, but I'll throw this idea/request out there and see what folks think.
A lot of what I use the API for is for WikiProjects. As such, I'm often getting a list of pages by looking for a project template, which is on the talk page. Then I have to turn that around and get the actual articles from main-space.
So I was wondering about way to get the "switch" of a page id. The two possibilities I thought of are:
action=query&prop=info&inprop=talkid&pageids=15580374
action=query&prop=revisions&titles=Talk:Main%20Page&rvprop=mainid
Either one would take a page or set of pages and return either the talk page id or the mainspace id.
Is this something that's doable? Desired? Thoughts?
The inprop=talkid suggestion sounds doable, I'll implement that soon.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
Ian Cabell schreef:
Would that be reversable? where inprop=talkid would return the talk page id if the page given is a main page, and inprop=mainid would return the main page if a talk page is given?
The other question that comes to mind is - would this work in other spaces? Like template-space or category-space?
Yes, and yes.
Roan Kattouw (Catrope)
Ian Cabell wrote:
Would that be reversable? where inprop=talkid would return the talk page id if the page given is a main page, and inprop=mainid would return the main page if a talk page is given?
The other question that comes to mind is - would this work in other spaces? Like template-space or category-space?
Thanks! --Ian
Instead of mainid, it should be subjectid, for consistence with the magic words {{TALKSPACE}} and {{SUBJECTSPACE}} ({{ARTICLESPACE}} is an alias for {{SUBJECTSPACE}}, but articleid would be too ambiuous).
Platonides schreef:
Instead of mainid, it should be subjectid, for consistence with the magic words {{TALKSPACE}} and {{SUBJECTSPACE}} ({{ARTICLESPACE}} is an alias for {{SUBJECTSPACE}}, but articleid would be too ambiuous).
That's what I added in r32413 [1] and r32416 [2]. An example request:
api.php?action=query&prop=info&inprop=talkid|subjectid&titles=Main%20Page|Talk:Main%20Page|Category:Infobox|Category%20talk:Infobox
<api> <query> <pages> <page ns="15" title="Category talk:Infobox" missing="" subjectid="37" /> <page pageid="54" ns="0" title="Main Page" touched="2008-03-18T19:08:17Z" lastrevid="470" counter="97" length="95" talkid="12" /> <page pageid="12" ns="1" title="Talk:Main Page" touched="2008-03-14T12:50:11Z" lastrevid="465" counter="68" length="202" subjectid="54" /> <page pageid="37" ns="14" title="Category:Infobox" touched="2008-03-18T19:08:01Z" lastrevid="119" counter="3" length="15" new="" /> </pages> </query> </api>
Note that if the 'talkid' or 'subjectid' attributes will simply be missing if the subject or talk page in question doesn't exist (Category:Infobox in the example), and that they're also present for missing titles (Category talk:Infobox in the example).
Roan Kattouw (Catrope)
[1] http://svn.wikimedia.org/viewvc/mediawiki/?view=rev&revision=32413 [2] http://svn.wikimedia.org/viewvc/mediawiki/?view=rev&revision=32416
mediawiki-api@lists.wikimedia.org