Aug 092012

If you’re fiddling with automation, or want to be able to pull information out of the Mozilla Developer Network wiki, there are some helpful queries you can do with URLs that may help you out. Today, I’m going to share those.

The Kuma API

While we don’t yet have a writable API (we know this is a problem, and a design for it is underway), we do have various ways to access useful information about pages in the wiki.

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,
&macros Instructs Kuma to execute all the templates in the page. For example:
&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:
$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:$json

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

Kuma feeds

In addition to the API described above, we also offer a number of feeds. There will likely be more in the future, and some of these are still something of a work in progress, but this information may still be useful for you.

All feeds start with the string “<locale>/docs/feeds/<format>/”, where <locale> is one of the standard locale strings, such as “en-US”, “ja”, and so forth. Note that at present, the locale you specify doesn’t impact the output, but it may eventually do so (indeed, I hope it will). <format> is one of “atom”, “rss”, or “json”.

Feed Description
all All recently changed articles, in order of modification date. This includes newly created articles. All changes are combined into one entry in the feed for each article.
revisions Each revision made to an article, in order by modification date, including newly created articles. Each revision has a separate entry in the feed.
tag/<tagname> Recently changed articles, in order by modification date. Only articles that have the specified tag are included in the feed.
files Recently changed or uploaded files.
needs-review[/<reviewtype>] A list of articles that have the specified review request checked, or all articles with a review requested if you don’t specify a review type. The review type can be one of “tech”, “editorial”, or “kumascript”.

So, for example, you can get an atom format feed of recently changed articles tagged with “JavaScript” thusly:

Wrapping up

Hopefully these are useful! There’s more to come, but these are a great start! Enjoy!

 Posted by at 9:15 AM

  2 Responses to “Kuma: Cool URL tricks”

  1. I’ve fixed that 404; I had corrected that on the Hacks blog but forgot to fix it here. Thanks!