Why do I get quill errors why I try to PATCH (or POST) a Discussion using the API
https://trial1.vanillacommunity.com/api/v2/discussions/6
{
"format": "rich",
"body": "I would like to learn to fly high."
}
ERROR:
{
"message": "Validation Failed",
"status": 400,
"errors": [
{
"field": "body",
"code": "JSON could not be converted into quill operations.\n <p>I would like to learn to fly high.</p>",
"status": 400,
"message": "JSON could not be converted into quill operations.\n <p>I would like to learn to fly high.</p>."
}
]
}
Works fine if I use "text" or "markdown"
Best Answers
-
You gave a plain text string that isn't the correct rich format. That string should be expressed as either text or markdown like you did. Really, the rich format is for the rich editor that has quite a complex internal format that is not easily typed into an API call by hand.
1 -
If you are posting direct HTML then the format is actually "wysiwyg". This is slightly counter-intuitive, I know, but we have an older "html" format that also does a bit of post-processing on the text.
1
Answers
-
Hi Rhys. The permission check is using the wrong parameter. I'm working on a fix for this right now (https://github.com/vanilla/vanilla/pull/10539). I just linked it to the issue you filed.Never mind. Different issue. Should have read through the post.
0 -
Excellent... so it wasn't me :-)
Addon question: what if I want to use html formatting: e.g. when I GET the comment it comes back with <p> in the body, but if I make my change and send it back like that the <p> tag shows as it is in the post if I use format : text
"<p>My favourite are woodpeckers. Have to climb trees to get them though.</p>",
0 -
We generally have a
GET /resource/:id/editendpoint that you can use to get the original body that was posted in back.0