Hi
I wish to have a querystring with sectionname=Name of the section. Is it possible? or how can i acheive.
Thanks & Regards Mahir
2011/2/13 Mohamed Mahir Ahamed Ibrahim mahir78@gmail.com:
Hi
I wish to have a querystring with sectionname=Name of the section. Is it possible? or how can i acheive.
You can't do this directly, because there are all sorts of problems with section names (duplicate names, for one thing). However, you can retrieve the contents of a section by its number, by appending e.g. &rvsection=3 to the normal page content query to get the content of the 3rd section. You'd first have to look up the section number in the section tree though.
Example: http://en.wikipedia.org/w/api.php?action=parse&page=Barack_Obama&pro...
<s toclevel="3" level="4" line="Health care reform" number="4.2.2" index="15" fromtitle="Barack_Obama" byteoffset="89649" anchor="Health_care_reform" />
So the section called "Heath care reform" (line field) has number 15 (index field).
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles...
returns the content of the section on health care reform.
Roan Kattouw (Catrope)
Thanks Roan Kattouw. Sure It will help me.
On Sun, Feb 13, 2011 at 4:04 PM, Roan Kattouw roan.kattouw@gmail.comwrote:
2011/2/13 Mohamed Mahir Ahamed Ibrahim mahir78@gmail.com:
Hi
I wish to have a querystring with sectionname=Name of the section. Is it possible? or how can i acheive.
You can't do this directly, because there are all sorts of problems with section names (duplicate names, for one thing). However, you can retrieve the contents of a section by its number, by appending e.g. &rvsection=3 to the normal page content query to get the content of the 3rd section. You'd first have to look up the section number in the section tree though.
Example:
http://en.wikipedia.org/w/api.php?action=parse&page=Barack_Obama&pro...
<s toclevel="3" level="4" line="Health care reform" number="4.2.2" index="15" fromtitle="Barack_Obama" byteoffset="89649" anchor="Health_care_reform" />
So the section called "Heath care reform" (line field) has number 15 (index field).
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles...
returns the content of the section on health care reform.
Roan Kattouw (Catrope)
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api
mediawiki-api@lists.wikimedia.org