Modèle:ApiEx
This template is used by the API documentation pages to format example queries.
Usage:
{{ApiEx | desc=Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ... | p1=action=query | p2=titles=Project:articleA{{!}}article_B | result=<syntaxhighlight lang="xml"> <api> <query> <normalized> <n from="Project:articleA" to="Wikipedia:ArticleA" /> <n from="article_B" to="Article B" /> </normalized> <pages> <page ns="4" title="Wikipedia:ArticleA" missing="" /> <page ns="0" title="Article B" missing="" /> </pages> </query> </api> </syntaxhighlight> }}
Capitalization, localization, "_" => " ", "Project" => "Wikipedia", ... |
api.php ? action=query & titles=Project:articleA|article_B
<api>
<query>
<normalized>
<n from="Project:articleA" to="Wikipedia:ArticleA" />
<n from="article_B" to="Article B" />
</normalized>
<pages>
<page ns="4" title="Wikipedia:ArticleA" missing="" />
<page ns="0" title="Article B" missing="" />
</pages>
</query>
</api>
Parameters:
- desc - query description
- lang - two letter code for the wiki language. 'en' by default.
- p1-p9 - parameter groups, each containing one or more param=value pairs separated by an ampersand (&).
- result - the result of the query execution
- post - a "list" of ApiEx/Post objects, to generate a post table
Code from : mw:template:ApiEx