Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence Rest API: Why can't I create page?

Kelly_Graver
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 16, 2020

I'm using OAuth 2.0 (3LO) to access the Confluence API from my app. I'm able to GET spaces fine, but trying to POST a new page gives me a 403 error. This is how my request is structured using superagent:

 

request.post('https://api.atlassian.com/ex/confluence/<MyCloudId>/wiki/rest/api/content')
.set('Authorization', 'Bearer ' + <MyAccessToken>)
.send({
"type": "page",
"title": "Test",
"space": {
"key": "TS"
},
"body": {
"storage": {
"value": "<p>Test page</p>",
"representation": "storage"
}
}
})
.then(...);

 

The documentation says a response code of 403 either means the space doesn't exist or I don't have permission to create the page.

I've tried different space keys and IDs from my Confluence instance and triple checked I have the OAuth scope of write:confluence-content, but still getting 403.

Not sure what I'm doing wrong, any help would be appreciated!

1 answer

1 accepted

1 vote
Answer accepted
Kelly_Graver
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 18, 2020

For anyone having a similar issue, I got it to work in Postman by adding these headers to my request:

'X-Atlassian-Token': 'no-check'

'Accept': 'application/json'

'Content-Type': 'application/json'

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events