Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

I am getting 500 internal server error when trying to update a page.

Edited
  1. Command that I am using is curl -u  username:password -H "Content-Type: application/json" - X PUT -d '{"id" :"pageid", "type" :"page", "title" :"Delphix", "body" :{"storage" :{"value" :"<p>test</p>", "representation" :"storage"}}, "version" :{"number" :6}}' https://companyurl/confluence/rest/api/content/pageid

2 answers

1 accepted

2 votes
Answer accepted
Pramodh M Community Leader Jan 15, 2022

Hi @suman151 

Please find the steps for updating the page

First, make an API call to get the Content ID (Page ID) using below API

curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content?title=myPage%20Title &spaceKey=TST&expand=history"

Once you have got the page ID, make a GET call to the Page using below API

curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content/3473411?expand=body.storage"

Now for the important part, updating the page with the ID

curl -u admin:admin \
-X PUT -H
'Content-Type: application/json' \
-d
'{ "id":"3604482", "type":"page", "title":"new page",
"space":{"key":"TST"},
"body":{
"storage": {
"value": "<p>This is the updated text for the new page</p>",
"representation":"storage"}},
"version":{"number":2}
}'
http://localhost:8080/confluence/rest/api/content/3604482

One thing though the URL will be your base URL and then this "rest/api/content/3604482"

Other than that your REST Call looks good

Let me know if this works for you!!

Thanks,
Pramodh

Thanks Pramodh

It worked for me. 

Like Pramodh M likes this
0 votes
Pramodh M Community Leader Jan 15, 2022

Hi @suman151 

Welcome to the Community!!

Please follow this community link for reference

https://community.atlassian.com/t5/Confluence-questions/How-to-edit-the-page-content-using-rest-api/qaq-p/904345

Thanks,
Pramodh

Hi, 

I tried the resource u have provided. But still getting the same response. And if i am not using confluence in the api then getting 405 error. So can you please help more on this. 

Pramodh M Community Leader Jan 15, 2022

@suman151 

Are you able to successfully access confluence via UI?

If so, get the page via the GET request and we need to use that for PUT request in order to update the page.

Thanks,
Pramodh

Yes, I am able to successfully access confluence via UI and get request is also working fine. But getting 500 error when using PUT requesr type. 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

42,583 views 29 133
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you