Forums

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

Cannot make a page in a Confluence Space using REST API.

Sufficient Monk January 5, 2022

I am trying to do a post request on my companies confluence to make a page using the REST API.

When I attempt to do it, I get a JSON response saying that it is forbidden.
I am able to make a page from the GUI, but not with the REST Api.
I have done Basic Authentication for the query.
Below is a picture of the request and the response.

My Question : how can I make the page on the confluence space with the rest Api?
I have tried: making a personal access token. And then using it with my request, but that didnt work either. 

doubt2.png

1 answer

1 accepted

1 vote
Answer accepted
Pramodh M
Community Champion
January 5, 2022

Hi @Sufficient Monk 

Can you try below API and let me know the result

curl -u username:password -X POST -H 'Content-Type: application/json' \
-d '{"type":"page","title":"new page", "ancestors":[{"id":1638403}], "space":{"key":"SPACE_KEY"},"body":{"storage":{"value": "<p>This is a new page</p>","representation":"storage"}}}' \
http://confluence-site-url/rest/api/content

Thanks,
Pramodh

Pramodh M
Community Champion
January 5, 2022
Like Sufficient Monk likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events