Request to RESTBase: `POST /{domain}/v1/transform/html/to/wt`.
**TBD:**
* [ ] Request content type, headers, body model
* [ ] Response status, content type, headers body model
For an existing page, title and revision are passed: `POST /{domain}/v1/transform/html/to/wt/{title}/{revision}`
RESTBase retrieves the original html, wikitext & data-parsoid from storage & POSTs it to Parsoid:
```
POST parsoid/v2/{domain}/wt/{title}/{oldid}
{
"html": {
"headers": {
"content-type": "text/html;profile=mediawiki.org/specs/html/1.0.0"
},
"body": "<html>The modified HTML</html>"
},
"original": {
"revid": 12345,
"wikitext": {
"headers": {
"content-type": "text/plain;profile=mediawiki.org/specs/wikitext/1.0.0"
},
"body": "the original wikitext"
},
"html": {
"headers": {
"content-type": "text/html;profile=mediawiki.org/specs/html/1.0.0"
},
"body": "the original HTML"
},
"data-parsoid": {
"headers": {
"content-type": "application/json;profile=mediawiki.org/specs/data-parsoid/0.0.1"
},
"body": {
"ids": {}
}
}
}
}
```
If the modified `html` is just a string, then Parsoid is expected to assume that it's in the latest html version.
Parsoid returns the wikitext, which RESTBase returns to the client without any caching:
```
{
wikitext: {
headers: {
'content-type': 'text/plain;profile=mediawiki.org/specs/wikitext/1.0.0'
},
body: "the modified wikitext"
}
}
```
We could also just return the wikitext with the appropriate content-type header, but there is something to be said for consistency & the ability to return additional metadata (like warnings or errors) in the future.
== Status ==
* [ ] augment the POST /{domain}/v1/transform/<html|wt>/to/html endpoint to:
* [ ] allow an optional bodyOnly field **-- PR in [[ https://github.com/wikimedia/restbase/pull/153 | restbase#153 ]]**
* [x] accept an application/json body
* [ ] accept a multipart/form-data body **-- PR in [[ https://github.com/wikimedia/restbase/pull/154 | restbase#154 ]]**
* [ ] add html-to-wikitext support
* [ ] store wt //-- see [[ https://github.com/wikimedia/parsoid/blob/master/lib/mediawiki.ApiRequest.js#L224 | how Parsoid gets wt from the MW API ]]//