Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Not able to Create Child Page

PASUPULA REDDY February 9, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
February 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
AUG Leaders

Atlassian Community Events