Forums

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

Page is created top level, but not as child page

Björn
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 13, 2021

i'm using Confluence Rest Api to create a new page :

That's my input

"{\"id\":null,
\"type\":\"page\",
\"title\":\" my new page\",
\"space\":{\"key\":\"TST\"},
\"status\":\"current\",
\"container\":{\"Id\":null,\"Type\":null},
\"ancestors\":[{\"Id\":2150269501}],
\"body\":{\"view\":null,\"export_view\":null,\"styled_view\":null,\"storage\":{\"value\":\" This page was created automatically \",

\"representation\":\"storage\"},\"editor\":null,\"editor2\":null,\"wiki\":null,\"anonymous_export_view\":null,\"plain\":null,\"atlas_doc_format\":null,\"raw\":null}}"

 

ancestor is the id of an existing page.

 

the new page is created, but on top level, not as child of my ancestor page.

What is wrong ?

1 answer

0 votes
Kishan Sharma
Community Champion
September 14, 2021

Hi @Björn Welcome to the Atlassian Community.

I was able to create a child page with below JSON Body. In below example - 1234 is the page ID of my parent page under which i wanted to create a child page -

POST - https://kishansharma.com/wiki/rest/api/content

 
{

"type":"page",

"title":"Created-From-API",

"space":{

"key":"KishanSharma"

},

"ancestors": [

{

"id": 1234

}

],

"body":{

"storage":{

"value":"some-text",

"representation":"storage"

}

}

}
Björn
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 14, 2021

Hello Kishan,

 

that helped me. Thanks a lot.

 

it works now.

Kishan Sharma
Community Champion
September 14, 2021

Great, you are welcome @Björn , please accept the answer if you have found it useful, so that it will help others having similar query in future.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events