[Mediawiki-api] Section editing in the API

Roan Kattouw roan.kattouw at home.nl
Fri Mar 14 13:25:29 UTC 2008


Roan Kattouw schreef:
> The content of a section cannot be 
> retrieved from the API right now 
That's just become possible. I introduced the rvsection parameter in 
r31969 [1], so you can now retrieve section content with:

api.php?action=query&prop=revisions&rvprop=content&rvsection=3&titles=Foo|Bar

This will retrieve the content of the 3rd section of Foo and Bar. Note 
that if either Foo or Bar has less than three sections, you'll get an 
error message.

Also note that section numbers can differ between revisions of the same 
page. For that reason, the following request might not do what you expect:

api.php?action=query&prop=revisions&rvprop=content|user|timestamp|comment&rvsection=15&rvlimit=10&titles=Foo

This will return the 15th section of each of the 10 most recent 
revisions of Foo. This could give you 10 slightly different versions of 
the same section, but it could also give you 3 versions of one section 
and 7 versions of another if a section was added or removed at some 
point. Therefore, diff'ing sections in this way does not always produce 
meaningful output.

Roan Kattouw (Catrope)

[1] http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=31969



More information about the Mediawiki-api mailing list