"statusCode": 403 - "Could not create content with type page"

I'm having issues with creating a page (child of another page which I provide the ID for) in the company's Confluence wiki via command line. I get status code 403, which tells me I could not create content with type "page".

 

My command ("user" and "mycompany" being placeholder names for this post):

 

curl -u user -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"new page","ancestors":[{"id":54362173}],"space":{"key":"TST"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' https://mycompany.atlassian.net/wiki/rest/api/content/ | python -m json.tool

 

It asks for my password and I provide the correct one, and then this is the output I get:

 

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

 

I have permissions to create a page via the Confluence interface (and I have, several times), but this seems to be telling me otherwise. Can anyone shed some light into why this is happening and what I can do to fix it?

Also, I should mention I've gotten comment-posting via command-line to work, so I do indeed have permissions for the wiki.  But for creating and editing pages via this method, I'm having this problem.

3 answers

Check the  space paramater.  I had this error when this was not correct.  The error is not informative.

"space":{"key":"My Project"},  Failed with the 403 error

"space":{"key":"MyProject"},  worked.

As per Steven Lancashire post using GET on the parent page will show you the exact name for the space:

curl -u admin:admin https://mycompany.atlassian.net/wiki/rest/api/content/54362173

This was my issue as well. Thanks!

0 votes

It looks like what you are doing is correct, and so I have to assume it is a permission problem. As you probably know, the return code 403 indicates that you are forbidden from performing the action.

Do you have permission to create pages under the ancestor?  And does the ancestor definitely exist?

Try performing a GET on https://mycompany.atlassian.net/wiki/rest/api/content/54362173

There is definitely some problem with this.  I'm using a password that can successfully download and edit the page, there are no restrictions on the page,  I'm admin on the space, and I created the page I'm trying to make a child page of.

 

Worse, this was working correctly last week, but this week I get a 403 error.  Is there any way for a hosted user to get additional debug information to see what the problem is?

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 11, 2018 in Confluence

What are your project planning tips?

Hello Community,  Jessica here from the Confluence product marketing team! Today I wanted to get your takes on project planning –– what works, what doesn’t, how do you know if you’re doing it r...

240 views 1 4
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