When creating a page in Atlassian Document Format(ADF) using the REST API, a blank page is created

When creating a page in Atlassian Document Format(ADF) using the REST API, a blank page is created.
This is the request Iam making.

HTTP method : POST
Endpoint : https://`my-site-name`/wiki/rest/api/content

{“space”:{“key”:“space key”},“status”:“current”,“title”:“test”,“type”:“page”,“body”:{“representation”:“atlas_doc_format”,“value”:{“version”:1,“type”:“doc”,“content”:[{“type”:“paragraph”,“content”:[{“type”:“text”,“text”:"Hello "},{“type”:“text”,“text”:“world”,“marks”:[{“type”:“strong”}]}]}]}}}

I’d really appreciate someone telling me where I am going wrong.

There are a few things I can see wrong.

First, you need to use the correct double quotes, that is " instead of .

Second, the format and structure of your request body is incorrect. It should look like this:

{
    "type": "page",
    "title": "test",
    "status": "current",
    "space": {
        "key": "SPACEKEY"
    },
    "body": {
        "atlas_doc_format": {
            "representation": "atlas_doc_format",
            "value": "{\"version\":1,\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Hello \"},{\"type\":\"text\",\"text\":\"world\",\"marks\":[{\"type\":\"strong\"}]}]}]}"
        }
    }
}

Don’t forget to stringify the ADF.

I would also recommend using the v2 endpoint since the v1 endpoint will soon be deprecated.

I am truly grateful for your assistance!
Thanks to your help, I was able to resolve the issue.
I will also give the v2 endpoint a try.

1 Like