Forums

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

Confluence REST API, Create new page does not work, update are working well

Aliaksandr Shchurko
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!
July 26, 2017

Hello,

 

I'm trying to use postman tool to create API call for creation of new confluence page.

I've also used python console too for that, but in any casese it's does not work.

 

POST /confluence/rest/api/content/ HTTP/1.1
Host: leverxeu.atlassian.net
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Accept: application/json
Cache-Control: no-cache
Postman-Token: 986c9484-c4e6-87be-891c-6ba1b7e079dd

{
"title": "My new title",
"type": "page",
"space": {"key":"LXEMP02"},
"body":{
"storage":{
"value":"<p>New page data.</p>",
"representation":"storage"
}
}
}

 

System always return the same response if you will call the same endpoint with GET method. No errors no messages always code 200

 

Could somebody help me with that?

 

REST API for updating page are working well.

 

PUT /confluence/rest/api/content/91980485 HTTP/1.1
Host: leverxeu.atlassian.net
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: application/json
Accept: application/json
Cache-Control: no-cache
Postman-Token: 911456d9-b5b1-1440-4686-7de6f51d492c

{"id":"91980485","type":"page",
"title":"new page","space":{"key":"LXEMP02"},"body":{"storage":{"value":
"<p>This is the updated text for the new page</p>","representation":"storage"}},
"version":{"number":2}}

 

 

1 answer

1 accepted

0 votes
Answer accepted
Aliaksandr Shchurko
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!
July 31, 2017

I've used wrong documentation and end point:

https://developer.atlassian.com/display/CONFDEV/Confluence+REST+API

Robert Metcalf December 1, 2017

I have the same problem. I am sending a POST to http://wiki.xx.ac.uk/rest/api/content/

It dosen't matter if I give invalid JSON all I get back is a 200 OK and the results as if I ran a get.

I am able to update pages by sending a PUT to

http://wiki.xx.ac.uk/rest/api/content/913

The documentation you point to is the one I am using. Can you tell me which documentation you are using, which you were using and why there is a difference between the two?

Spencer Gilbert
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!
July 19, 2019

Did your issue ever get resolved @Robert Metcalf ? I'm having the same issue right now as well. The confluence server API always returns a list of pages I didn't request to GET when I try to POST a new page to a wiki.

Like 정예린 likes this
Matt Leicht
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!
June 11, 2020

Make sure you are using HTTPS.  I was using HTTP by mistake and I believe the server was redirecting it to a GET request thus always returning response 200.

Like # people like this
deniskutovskiy
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!
November 4, 2020

@Matt Leicht Accidental using of HTTP was my issue. Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events