Forums

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

Create a page with REST API and directly set permissions

Robin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2025

Hi folks,

I want to create a page within Confluence Data Center with REST API. But the content is confidential and I have to take care to directly set restrictions to the page.

 

For sure I had a look into the current API documentation (https://developer.atlassian.com/server/confluence/rest/v1010/api-group-content-resource/#api-rest-api-content-post). And there is a teaser which attributes should be passed, but I am not able to get this run.

Tested it with something like this:

curl --location 'https://my-server/confluence/rest/api/content/' \
--header 'Content-Type: application/json' 
--data '{
    "type":"page",
    "title":"test4",
    "ancestors": [
        {
            "id":627248505
        }
    ], 
    "space": {
        "key":"Testspace"
    },
    "restrictions": { "operation""update""restrictions": { "group": [ "Testgroup"] } },
    "body": {
        "storage": {
            "value":"<at:declarations /><ac:layout>foobar</ac:layout>",
            "representation":"storage"
        }
    }
}'

I get no error message. My page is created but the restrictions are missing. I created dozens of versions with the restrictions parameter. Please help me.. :(

2 answers

0 votes
Ryan M
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2025

I think the correct way to form the restrictions portion is as follows

    "restrictions": {
        "update": {
            "restrictions": [
                {
                    "type": "group",
                    "name": "Testgroup"
                }
            ]
        }
    }, 

 However I don't have a test environment handy I can try it in right now, but you may want to try that. 

0 votes
Florian Bonniec
Community Champion
September 11, 2025

Hi @Robin 

 

SO you get response that the page is created but the page is empty ? Is it in the UI or same if you then fetch the page using the API ?

 

Regards

Robin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2025

sorry for confusion. I missed to have a look for the storage format. My page is created with my content. Just the permissions are missing. sorry for that.

Florian Bonniec
Community Champion
September 11, 2025

I think you have to do 2 calls. 

  1. Create page
  2. Add restriction

If there is a risk for the content to be access between the 2 calls, that I'm not sure is possible you can apply restriction on the parent first.

  1. Apply restriction on the parent
  2. Create page
  3. Apply restriction on the page
  4. Remove restriction on the parent

 

Regards

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.5
TAGS
AUG Leaders

Atlassian Community Events