User:Mike-ZeleaCom/ApiEx

From Wiki
Jump to: navigation, search

This template is used by API documentation pages to format example queries.

Usage:

{{User:Mike-ZeleaCom/ApiEx
| desc=An example
| p1=param1=value1
| p2=param2=value2
| result=<source 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>
</source>
}}
An example
edo ? param1=value1 & param2=value2
<source 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>

</source>

Parameters:

  • desc - query description (optional)
  • p1-p9 - parameter groups, each containing one or more param=value pairs separated by an ampersand (&).
  • result - the result of the query execution (optional)
  • post - a "list" of ApiEx/Post objects, to generate a post table (not sure exactly what this is, see the original site)

Modified from http://www.mediawiki.org/w/index.php?title=Template:ApiEx&oldid=283697.

This template page is made available under the Creative Commons Attribution/Share-Alike License.