< Parsoid‎ | API
Jump to navigation Jump to search

v1 API is now deprecated. These docs have been archived from the main API docs page.

The {prefix} in these examples refers to the configured wiki id as available in the siteinfo API request. Examples: 'enwiki', 'frwiki', 'dewiki' etc. {page} refers to the canonical page name with spaces replaced with underscores; page should also be URL-encoded with a function like PHP's urlencode. Examples: 'Main_Page', 'Barack_Obama' etc.

GET /{prefix}/{page}?oldid={revision} 
Get HTML for a given page revision. Example: /enwiki/Main_Page?oldid=598252063.
POST /{prefix}/{page}
Convert passed-in wikitext or html
The {page} path component should be provided if available. Both it and the oldid parameter are needed for clean round-tripping of HTML retrieved earlier with GET /{prefix}/{page}?oldid={revision}.
HTML to Wikitext
the revision id this is based on (if any)
HTML to serialize to wikitext
Wikitext to HTML
Wikitext to parse to HTML
body (optional) 
boolean flag, only return the HTML body.innerHTML instead of a full document
For example, using the cURL command-line tool
$ curl localhost:8000/localhost/Main_Page -d wt="Hello ''world''" -d body=1

Convenience method:

GET /{prefix}/{page} 
Get HTML for the latest page revision, redirects to the full /{prefix}/{page}?oldid=12345 form. This redirect preserves any URL query params that had been passed in.