0

Added a paragraph to drupal8 via jsonapi and want this paragraph to be in an articles body. I thought it is as easy as

    "relationships": {
        "field_body": {
            "data": [
                {
                    "type": "paragraph--text",
                    "id": "b0247bf8-a3c0-4a45-8e05-4f4901011000"
                }
            ]
        }
    }
},

but the article is created and the field_body result is empty. It works already with other entities just fine. And the jsonapi gives me the paragraph /jsonapi/paragraph/text ...What is the problem, am I missing something?

1
  • How did you added Paragraph using JSONapi?
    – Rifas Ali
    Nov 14, 2019 at 6:12

1 Answer 1

0

Did you gave node type ? Try the following body data.

{
 "data": 
  {
     "attributes": {
            "title": "title of your new node", 

        },
         "relationships": {
            "field_body": {
                "data": {
                    "type": "paragraph--text",
                    "id": "b0247bf8-a3c0-4a45-8e05-4f4901011000"
                }
            }
        },
      "type": "node--yournode"
    }
  }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.