Parsoid/API

Parsoid converts MediaWiki's Wikitext to XHTML5 + RDFa and back.

A production version of Parsoid on the Wikimedia cluster can be accessed at http://parsoid-lb.eqiad.wikimedia.org/. In addition to the API defined below, the Parsoid service provides some form-based debugging tools at. These are subject to change and may disappear at any time.

Common HTTP headers supported in all entry points

 * Accept-encoding : Please accept gzip.
 * Cookie : Cookie header that will be forwarded to the Mediawiki API. Makes it possible to use Parsoid with private wikis. Setting a cookie implicitly disables all caching for security reasons, so do not send a cookie for public wikis if you care about caching.
 * x-request-id : A request id that will be forward to the Mediawiki Api.

v2 API
Parsoid gained a "v2" API in December 2014 to act as middleware behind RESTBase entry points. The spec for it is at.

The main addition is a new format, that responds to a request with a JSON structure containing separate   data for clean roundtripping between HTML and wikitext and a   key with slimmer HTML of {title} without   attributes.

For example, compare the value of html.body in
 * http://parsoid-lb.eqiad.wikimedia.org/v2/en.wikipedia.org/pagebundle/Siskiwit_Lake/650380826

with the HTML of
 * http://parsoid-lb.eqiad.wikimedia.org/enwiki/html/Siskiwit_Lake?oldid=650380826

Path Parameters
The entry points are of the form
 * : The hostname of the wiki, rather than the wiki database {prefix} in v1 entry points.
 * : Content format returned by the API.
 * : Page title.
 * : Page revision number.

Formats
Content formats returned by the API.
 * Parsoid's XHTML5 + RDFa output, which includes inlined  attributes. Content type is
 * Parsoid's XHTML5 + RDFa output, which includes inlined  attributes. Content type is


 * : A JSON blob containing the above  with the   attributes split out and ids added to each node. Content type is
 * : Wikitext. Content type is

Payloads
The payloads should be delivered as JSON.

For html2wt conversion

 * The wikitext to convert.
 * The wikitext to convert.


 * (optional)
 * A boolean flag. If true, returns only the   element of the result.
 * Note that this is subtly different from the RESTbase "bodyOnly" option, which returns the *children* of the &lt;body> element.

Keys

 * : Internal data for clean roundtripping between HTML and wikitext.


 * : Parsoid's XHTML5 + RDFa output.


 * : Everyone's favourite markup language.

These all should contain, {  "headers": { "content-type": "..." },  "body": "..." }

GET Requests
The acceptable format parameters for GET requests are  and.

Redirects to the latest revision.

Returns  for a given revision.

POST Requests
The acceptable format parameters for POST requests are  and.

v1 API entry points
'The v1 API will soon be deprecated. Please migrate your code to version 2.'

Parsoid/API/v1