Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Confluence Pages Using API (ADF Format)

川目 沙英
Contributor
January 23, 2025

API を使用して、Jira Service Management を自動化するためのページを Confluence で作成したいと考えています。

使用している API エンドポイントは Confluence Cloud API です

https://<your-site-namae>/wiki/rest/api/content

ADF(Atlassian Document Format)形式でデータを書き込むには、"representation": "atlas_doc_format"を設定します。

以下のカスタムデータを設定したところ、Confluenceページは無事に作成されたのですが、ページの内容が空白で値が反映されませんでした。

{
    "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"
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    }
}

この目的のためにカスタムデータを適切にフォーマットする方法についてアドバイスをいただけますか?

スクリーンショット_24-1-2025_173742_scsk-demo02.atlassian.net.jpeg

1 answer

0 votes
Alex David
July 27, 2026

Hey, from the screenshot there are two separate problems in that payload, and either one on its own gives you a page that gets created but comes out empty.

The first is that the body shape differs between the two API versions and yours is mixing them. You're posting to /wiki/rest/api/content, which is v1, but you've used the v2 flat shape with representation and value directly under body. On v1 it has to be nested one level deeper and keyed by the representation, so body.atlas_doc_format.value. Confluence ignores the fields it doesn't recognise on that endpoint instead of rejecting the request, which is exactly why you get a success and an empty page. If you'd rather use the flat shape you already have, point the request at the v2 endpoint, /wiki/api/v2/pages, where body.representation plus body.value is correct.

The second is that value has to be the ADF document serialised into a JSON string, not a nested JSON object. In your custom data it's currently an object starting with version and type doc. It needs to be a string whose contents are that same JSON. Worth knowing the failure mode isn't consistent between versions either, on v2 passing an object where a string is expected usually comes back as a 400 with "Invalid message", while on v1 it tends to go through quietly, so don't assume an error would have surfaced.

Two other things worth ruling out while you're in there:

- If you're checking the result with a GET, the body only comes back when you ask for it. Without body-format=atlas_doc_format on that request the body object looks empty even when the page is perfectly fine, which sends people chasing a bug that isn't there.

- If the content is genuinely stored but the editor still renders nothing, that's usually the editor property. On v1 you may need metadata.properties.editor set with key editor and value v2, otherwise Confluence can treat it as a legacy editor page and not render the ADF.

Your ADF itself looks structurally right, for what it's worth. Root has version 1 and type doc, and bold as a mark on the text node is correct, that's the right shape rather than a node type of its own.

Alex

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events