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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.