It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Not able to Create Child Page

Hi,

Not able to create the child page using rest api, posting JSON Code and error code below.please do the needfull.

Rest API Method Call: POST

JSON Code:

{
"title":"MYPAGE",
"space":
{
"key":"TST"
},

"ancestors":
[
{
"type":"page",
"id":28835843
}
],

"body":
{
"storage":
{
"value":"<p>This is a child page</p>",
"representation":"storage"
}
}
}

 

Error Code:405.

 

Regards,

Kulasekhar

 

1 answer

0 votes
Dario B Atlassian Team Feb 21, 2020

Helo @PASUPULA REDDY ,

 

The body of the request looks correct to me (assuming that the space key and ancestor id are correct) and error 405 means "method not allowed" so I am not sure what is going wrong here (maybe calling a different endpoint that only accepts PUT requests?).

However, I have tested this against my instance and everything works fine:

curl -u <EMAIL-ADDRESS>:<API-TOKEN> -X POST -H 'Content-Type: application/json' -d '{"type":"page","title":"created using rest api","ancestors":[{"id":380665857}], "space":{"key":"QWER"},"body":{"storage":{"value":"<p>This is a new page created using REST API</p>","representation":"storage"}}}' "https://<NAME>.atlassian.net/wiki/rest/api/content"


{"id":"634617857","type":"page","status":"current","title":"created using rest api","space":{"id":380600321,"key":"QWER","name":...........
[...] }

 

Can you kindly run the same test against your instance (replace <EMAIL-ADDRESS>, <API-TOKEN> and <NAME> with the appropriate data) and paste the result in here removing the sensitive data as in above example? 

 

 

Cheers,
Dario

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,465 views 6 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you