mozilla

Revision 340997 of The Kuma API

  • Revision slug: Project:The_Kuma_API
  • Revision title: The Kuma API
  • Revision id: 340997
  • Created:
  • Creator: lmorchard
  • Is current revision? No
  • Comment

Revision Content

{{draft}}

We support several useful query parameter options on every Kuma wiki document URL, when fetched via HTTP GET or viewed in a browser:

Command Description
?raw Instructs Kuma to return the raw content of the page, without any of the skin material, such as the headers, footers, and so forth. This does not execute templates or scripts. For example, https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw
&macros Instructs Kuma to execute all the templates in the page. For example: https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw&macros
&include Tells Kuma to strip out any blocks that have the class "noinclude" on them. This is useful to get the output as it would appear when included in another page, rather than as a standalone page. Often this will remove sample code and the like (although not always).
&section=[section-id] Instructs Kuma to return the content from only the section with the specified anchor name; for example: https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw&section=Semantics
$json Tells Kuma to describe the page in a JSON object; this object is essentially the same one you would get using the KumaScript routine wiki.getPage(). For example: https://developer.mozilla.org/en-US/docs/HTML/HTML5$json

These offer a lot of capability, and hopefully will be useful for people building developer tools and other utilities.

{{NoteStart}}We are currently testing out a PUT API for writing to wiki pages, but it needs work and might be too early to rely on yet.{{NoteEnd}}

Revision Source

<div>
  {{draft}}</div>
<p>We support several useful query parameter options on every Kuma wiki document URL, when fetched via HTTP GET or viewed in a browser:</p>
<table border="0" class="standard-table">
  <tbody>
    <tr>
      <th style="width:13em">Command</th>
      <th>Description</th>
    </tr>
    <tr>
      <td valign="top"><code>?raw</code></td>
      <td valign="top">Instructs Kuma to return the raw content of the page, without any of the skin material, such as the headers, footers, and so forth. This does not execute templates or scripts. For example, <a href="https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw">https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw</a></td>
    </tr>
    <tr>
      <td valign="top"><code>&amp;macros</code></td>
      <td valign="top">Instructs Kuma to execute all the templates in the page. For example: <a href="https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw&amp;macros">https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw&amp;macros</a></td>
    </tr>
    <tr>
      <td valign="top"><code>&amp;include</code></td>
      <td valign="top">Tells Kuma to strip out any blocks that have the class "noinclude" on them. This is useful to get the output as it would appear when included in another page, rather than as a standalone page. Often this will remove sample code and the like (although not always).</td>
    </tr>
    <tr>
      <td valign="top"><code>&amp;section=[section-id]</code></td>
      <td valign="top">Instructs Kuma to return the content from only the section with the specified anchor name; for example: <a href="https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw&amp;section=Semantics">https://developer.mozilla.org/en-US/docs/HTML/HTML5?raw&amp;section=Semantics</a></td>
    </tr>
    <tr>
      <td valign="top"><code>$json</code></td>
      <td valign="top">Tells Kuma to describe the page in a JSON object; this object is essentially the same one you would get using the KumaScript routine <code>wiki.getPage()</code>. For example: <a href="https://developer.mozilla.org/en-US/docs/HTML/HTML5$json">https://developer.mozilla.org/en-US/docs/HTML/HTML5$json</a></td>
    </tr>
  </tbody>
</table>
<p>These offer a lot of capability, and hopefully will be useful for people building developer tools and other utilities.</p>
<p>{{NoteStart}}We are currently testing out <a href="/en-US/docs/User:lmorchard/PUT-API" title="/en-US/docs/User:lmorchard/PUT-API">a PUT API for writing to wiki pages</a>, but it needs work and might be too early to rely on yet.{{NoteEnd}}</p>
Revert to this revision