URL parameters and document metadata

MDN's Kuma wiki platform doesn't have a central API. Instead, our general approach is to offer ways to turn human-accessible resources into machine-friendly data.

URL GET parameters

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

Multiple query parameters are separated by & instead of the initial ?. (See macros example.)


Directs Kuma to return only the page summary. If there is content on the page marked with the class "SEO summary", that content is returned. If there is no such content, the contents of a section entitled "Summary" are returned. Failing that, the contents of the first block are returned.

Bug notice: There is currently a bug that causes the summary parameter to return the entire document if you don't also specify the raw parameter. Note that you can also get the summary from the JSON returned using the $json alternate view.
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, which is handy for building editors.
Example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?raw
Instructs Kuma to execute all the templates in the page. When combined with ?raw, this offers fully-rendered MDN content without the site wrapper. Defaults to on without ?raw (ie. during normal site views), defaults to off when ?raw is present.
Example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?raw&macros
Instructs Kuma not to execute the KumaScript templates in the page. Since ?macros defaults to "on" during a normal site view, this option turns it off.
Example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?nomacros
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).
Example: https://developer.mozilla.org/en-US/docs/XUL/Attribute/align?raw&macros&include
Instructs Kuma to return the content from only the section with the specified anchor name.
Bug notice: There is currently a bug that causes the section parameter to return the entire document if you don't also specify the raw parameter.

Combined with the $children view, it expands the JSON response with detailed information per subpage. It works like a combination of $children and $json on each subpage. This way, one can learn about the tags for a subpage.

Example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5$children?expand

Document metadata resources

Along with parameters to tweak the response of a document URL, there are also some alternate views on documents specified by URL suffix:

Tells Kuma to return only the table of contents for the page in HTML. It's returned as an ordered list (that is, <ol>).
Example: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$toc
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().
Example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5$json
Tells Kuma to list the topic children of the page in JSON. This object is essentially the same one you would get using the KumaScript routine pages.subpages().
Example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5$children.
(This can be used with the ?expand parameter in order to have a more detailed response.)
Presents the source text line differences between revisions specified in required query parameters ?from and ?to.
Example: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$compare?to=911697&from=911067
Edits the current revision given document instead of displaying it.
Example: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$edit
Displays revision history of the newest ten revisions of given document instead of its contents. The full history can be requested with the ?limit=all query parameter value.
Example: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$history?limit=all
Displays the document revision number which must be specified after a "/" separator.
Example: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Tools/Document_parameters$revision/915141