How to set fixed-width when creating new page with Rest-Call?

When I create a new page with a Rest call in Confluence Cloud, the pages are set to full-width by default. But I need them to have that narrow layout, which should be default as what I read, but it isn’t. I set the editor version to v2, so I’m using the new editor.

Can I set the page width somewhere in my Rest call?

1 Like

Hi @hauke.hoerhold, did you find a solution? I have exactly the same problem. It looks like the POST /wiki/rest/api/content endpoint sometimes (but not always!) creates a page with a full-width layout.

I found out that you can, in theory, set the "content-appearance-draft" and "content-appearance-published" properties to "default" to create a fixed-width page but then the API call fails with an internal server error about 50% of the time.

This is how I set the properties when creating the page:

metadata: {
  properties: {
    "content-appearance-draft": { value: "default" },
    "content-appearance-published": { value: "default" },
    editor: { value: "v2" }
  }
}

And this is the error I get sometimes:

{
  "statusCode": 500,
  "message": "org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only"
}

When the error occurs, the page is still created but uses the old editor instead of the new one. I haven’t yet found a way to reliably create a page with a fixed-width layout. :frowning:

Also have the same issue, would looking forward to a solution. I prefer having fixed-width…

1 Like

No I didn’t find a solution…
I have assigned the metadata as you did (setting the content-appearance-draft and -published), but pages still are full-width.

Did you happen to find a solution here?

I am plagued by same bug.

Thanks in advance.

I actually got a solution by Atlassian Support. However did not yet had the chance to verify it:

After some communication with the developers and some testing, the correct keys for content-appearance-draft and content-appearance-published needs to be using an underscore character instead of a hyphen.

To correct the previous metadata property that we have previously shared, it should look like this:

"metadata": {
        "properties": {
            "editor": {"value":"v2"},
            "content_appearance_draft": {
                "value": "fixed-width"
            },
            "content_appearance_published": {
                "value": "fixed-width"
            }
        }
    }

So simply try to use “_” instead of “-”.

The version with underscores doesn’t work either, unfortunately. The endpoint for creating pages still sets the content-appearance-draft and content-appearance-published properties (with dashes) to full-width for some requests. The only solution I’ve found is to delete both properties after creating a page.

As you wrote, replacing dashes with underscores doesn’t help.

In some requests it sets the fixed width, in some it doesn’t. It seems to be random. I tried it with one page over and over, and in 30% of the cases it’s fixed. Very strange.

How do you delete both properties afterwards? Also with a Rest call?

@hauke.hoerhold I just got the feedback from the development team, that they are aware of the current issue and they will release a fix in the next 2-3 weeks. I try to keep you posted here.

2 Likes

How do you delete both properties afterwards? Also with a Rest call?

@hauke.hoerhold Yeah, I’m deleting the properties with a DELETE call.

@LarsStuber Thanks for following up! Do you know if this issue is tracked publicly somewhere?

@klaussner it got tracked internally. They replied that it has been fixed. I can also confirm that it is now working with

"metadata": {
    "properties": {
        "editor": {"value":"v2"},
        "content_appearance_draft": {
            "value": "fixed-width"
        },
        "content_appearance_published": {
            "value": "fixed-width"
        }
    }
}

At least with my few testing its now working as expected.