I have a Drupal 8.3 setup and working and want to add content via REST. I can create nodes fine, but only in plain text. I can't figure out and can't find any documentation for how to submit content as html so it could have formatting.
I found a comment that had examples for submitting comments with basic html with the body specified like:
{"content_body": {"format": "basic_html", "value": "<b>Hi</b>"}
But when I tried to do something similar with the 'body' tag for posting to /entity/node, it returns a 422 response with this message:
Unprocessable Entity: validation failed.\nbody: Body: this field cannot hold more than 1 values
For reference, this is basically the hal+json body of the post (minus the taxonomy stuff not relevant to this question):
{
"body": {
"format": "basic_html",
"value": "<b>This is the body of the test</b>"
},
"title": {"value": "Test One"},
"type": {"target_id": "Article"}
}
If I drop the 'format' tag from the body dictionary, everything works fine... except the tags are displayed and not interpreted as html.
Thanks in advance.