mozilla
Your Search Results

    The Kuma API Redirect 2

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

    Cross-Origin Resource Sharing

    Our intent is to enable CORS on all public data where it's safe to do so - which should include pretty much everything. If you find something that cannot be used with cross-origin requests, that's a bug to be fixed!

    Feeds (RSS & JSON)

    Check out the Feeds page, if you're interested in accessing various read-only feeds of data. These include changes to documents, documents by tag, and more. Feel free to file a bug if there's some collection of data you'd like from MDN that we don't yet offer!

    Or, better yet: Fork us on GitHub and submit a pull request!

    Document parameters

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

    Parameter 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, which is handy for building editors.

    For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?raw

    macros

    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.

    For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?raw&macros

    nomacros

    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.

    For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5?nomacros

    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).

    For example: https://developer.mozilla.org/en-US/docs/XUL/Attribute/align?raw&macros&include

    section=[section-id]

    Instructs Kuma to return the content from only the section with the specified anchor name.

    For example:

    summary 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.

    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:

    Suffix Description
    $toc

    Tells Kuma to return only the table of contents for the page in HTML. It's returned as an ordered list (that is, <ol>).

    For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5$toc

    $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/Web/Guide/HTML/HTML5$json

    $children

    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().

    For example: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5$children

    The PUT API

    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. Try it out and let us know how it works for you!

    Document Tags and Contributors

    Contributors to this page: Sheppy
    Last updated by: Sheppy,