Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to use RESTfull PUT to update a page?


I can create the page with a command like:

curl -D- -u 'U:P' -X POST -H "Content-Type: application/json" -d @DOC.json "https://url/wiki/rest/api/content?title=Test+Doc&spaceKey=MD"


This works! And the doc is created. Then I goto the page in a browser and get it id?



Then I use a GET to get the data using the id 4784186

curl -D- -u 'U:P' -X GET -H "Content-Type: application/json" https://url/wiki/rest/api/content/4784186


And I get info about the page:

{"id":"4784186","type":"page","status":"current","title":"Test Doc","space":{"id":196609,"key":"MD","name":"xxxxx","type":"global","status":"current","_expandable":{"settings":"/rest/api/space/MD/settings","metadata":"","operations":"","lookAndFeel":"/rest/api/settings/lookandfeel?spaceKey=MD","permissions":"","icon":"","description":"","theme":"/rest/api/space/MD/theme","history":"","homepage":"/rest/api/content/196610"},"_links":{"webui":"/spaces/MD","self":"https://.../wiki/rest/api/space/MD"}},"history":{"latest":true,"createdBy":{"type":"known","accountId":"5d9b7a4af8c67f0dbff6b290","accountType":"atlassian","email":"","publicName":"user","profilePicture":{"path":"/wiki/aa-avatar/5d9b7a4af8c67f0dbff6b290","width":48,"height":48,"isDefault":false},"displayName":"Craig Smith","_expandable":{"operations":"","personalSpace":""},"_links":{"self":"https://.../wiki/rest/api/user?accountId=5d9b7a4af8c67f0dbff6b290"}},"createdDate":"2019-10-29T20:38:35.616Z","_expandable":{"lastUpdated":"","previousVersion":"","contributors":"","nextVersion":""},"_links":{"self":"https://.../wiki/rest/api/content/4784186/history"}},"version":{"by":{"type":"known","accountId":"5d9b7a4af8c67f0dbff6b290","accountType":"atlassian","email":"","publicName":"name","profilePicture":{"path":"/wiki/aa-avatar/5d9b7a4af8c67f0dbff6b290","width":48,"height":48,"isDefault":false},"displayName":"Craig Smith","_expandable":{"operations":"","personalSpace":""},"_links":{"self":"https://.../wiki/rest/api/user?accountId=5d9b7a4af8c67f0dbff6b290"}},"when":"2019-10-29T20:38:35.616Z","friendlyWhen":"yesterday at 4:38 PM","message":"","number":1,"minorEdit":false,"syncRev":"0.confluence$content$4784186.2","syncRevSource":"synchrony-ack","confRev":"confluence$content$4784186.5","_expandable":{"collaborators":"","content":"/rest/api/content/4784186"},"_links":{"self":"https://.../wiki/rest/api/content/4784186/version/1"}},"macroRenderedOutput":{},"extensions":{"position":1872770356},"_expandable":{"childTypes":"","container":"/rest/api/space/MD","metadata":"","operations":"","children":"/rest/api/content/4784186/child","restrictions":"/rest/api/content/4784186/restriction/byOperation","ancestors":"","body":"","descendants":"/rest/api/content/4784186/descendant"},"_links":{"editui":"/pages/resumedraft.action?draftId=4784186","webui":"/spaces/MD/pages/4784186/Test+Doc","context":"/wiki","self":"https:/.../wiki/rest/api/content/4784186","tinyui":"/x/OgBJ","collection":"/rest/api/content","base":"https://.../wiki"}}


Then I try a PUT:

curl -D- -u 'U:P' -X PUT -H "Content-Type: application/json" -d @Text.json "https://.../wiki/rest/api/content/4784186


I get a HTTP 400 response:

HTTP/2 400 

server: AtlassianProxy/

cache-control: no-cache, no-store, must-revalidate

content-type: application/json

strict-transport-security: max-age=315360000; includeSubDomains; preload

date: Wed, 30 Oct 2019 14:31:29 GMT

atl-traceid: 6906da9b9b242901

expires: Thu, 01 Jan 1970 00:00:00 GMT

x-xss-protection: 1; mode=block

x-content-type-options: nosniff



{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: content id mismatch"}


With the only detail message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: content id mismatch"


Any ideas on what I am doing wrong. Any ideas on what to try?


Another try using the doc name:

curl -D- -u 'U:P' -X PUT -H "Content-Type: application/json" -d @Test.json "https://.../wiki/rest/api/content?title=Test+Doc&spaceKey=MD"


HTTP/2 400 

server: AtlassianProxy/

cache-control: no-cache, no-store, must-revalidate

content-type: application/json

strict-transport-security: max-age=315360000; includeSubDomains; preload

date: Wed, 30 Oct 2019 14:37:25 GMT

atl-traceid: 0a2d9bad15d046ac

expires: Thu, 01 Jan 1970 00:00:00 GMT

x-xss-protection: 1; mode=block

x-content-type-options: nosniff



{"statusCode":400,"data":{"authorized":false,"valid":true,"errors":[],"successful":false},"message":"com.atlassian.confluence.api.service.exceptions.BadRequestException: content id mismatch"}Craigs-MacBook-Pro:tmp csmith$ 

Craigs-MacBook-Pro:tmp csmith$ 

Craigs-MacBook-Pro:tmp csmith$ vi 

Craigs-MacBook-Pro:tmp csmith$ ./ 

./ line 6: unexpected EOF while looking for matching `"'

./ line 8: syntax error: unexpected end of file

Craigs-MacBook-Pro:tmp csmith$ vi 

Craigs-MacBook-Pro:tmp csmith$ ./ 

HTTP/2 405 

server: AtlassianProxy/

content-type: application/octet-stream

strict-transport-security: max-age=315360000; includeSubDomains; preload

date: Wed, 30 Oct 2019 14:44:16 GMT

atl-traceid: f866e40a3b5f49b6

x-xss-protection: 1; mode=block

x-content-type-options: nosniff



content-length: 0


1 answer

1 accepted

0 votes
Answer accepted
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 31, 2019


Thanks for including your multiple curl attempts and the output from said attempts. From reviewing what you’ve included I do see you don’t have the version incremented from the original GET call. With this said, you’ll need to increment the version number +1 from your GET call since a PUT method will create a new version. Further information on this is listed within the REST API docs;

version REQUIRED


The new version for the updated content. Set this to the current version number incremented by one, unless you are changing the status to 'draft' which must have a version number of 1.

Source documentation: PUT /wiki/rest/api/content/{id}

Please let us know if this helps to get past your response of 400.

Stephen SIfers

Thanks Stephen! Yes, I kept at it and found that I needed to bump the version number to get the PUTs to work. Now I an working out a way to curl to the the current version number so I can bump it and use the next version number in the PUT.


Thanks again for the reply!

Like Stephen Sifers likes this

I am using simple update_page function. still Im getting error:

atlassian.errors.ApiValueError: No space or no content type, or setup a wrong version type set to content, or status param is not draft and status content is current.


How to solve this?

Please help

run ruan
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!
Apr 07, 2023

you need escape body content when update_page

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events