Confluence REST API unable to create Child page

Hi,

I am trying to create a Child page in Confluence using restAPI but getting a 403 error response.

Request:

{
"type":"page",
"title":"New child page",
"ancestors":[

{"id":206583541}

],
"space":{"key":"/rest/api/space/MySpace"},
"body":
{"storage":
{"value":"<p>This is a new child page</p>",
"representation":"storage"}
}
}

Respone:

{
"statusCode": 403,
"data": {
"authorized": false,
"valid": true,
"errors": [],
"successful": false
},
"message": "Could not create content with type page"
}

Note: I am able to run a GET and PUT (update the confluence pages) succesfully.

 

 

 

2 answers

Do you really pass "/rest/api/space/MySpace" string as a space key?

Hi Pavel,

Yes I do pass /rest/api/space/MySpace as space key.
Also, I am able to create the page manually in confluence, so I am guessing its not permission issue.

I was able to resolve the issue by fixing my request.

The space key had to be updated from:
"space": {
"key": "/rest/api/space/MySpace"
},

 

to 

"space": {
"key": "MySpace"
},

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

865 views 23 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you