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
4,298,515
Community Members
 
Community Events
165
Community Groups

Update page with Rest API returns 200 but the page is not updated

I used Google App Script and Rest API to update a Confluence page.

Firstly, i use GET method to get the page information with (myhost.net/wiki/rest/api/content/123456?expand=body.storage,version).

Then, i use PUT method to update the page information like below

var data = {
"id": "123456",
"title": "My title",
"space": {
"key": "MySpace"
},
"type": "page",
"body":{
"storage": {
"value": "my text",
"representation":"storage"
}
},
"version": {
"number": currentBodyData.version.number + 1
}
};

var response = UrlFetchApp.getRequest("myhost.net/wiki/rest/api/content/123456",{
method: 'PUT',
headers: {
"Authorization": "Basic " + token,
"Content-Type": "application/jsonl; charset=utf-8"
},
body: JSON.stringify(data)
});

 

Response has the code 200 but the Confluence page is not updated.

Thanks for your help.

1 answer

1 accepted

0 votes
Answer accepted
Dominic Lagger Community Leader Apr 19, 2022

Hey @Guillaume Sinnaeve 

First thought is, that you updated an older version. Did you check that? 

And the second thought was, that you do not update the version number, but at a second look, I saw that you do. 

Does this happen to all pages, you want to edit via REST? 

Also the history didn't change? 

Regards, Dominic

Hey @Dominic Lagger ,

Thanks for your reply.

At this moment, i only do my test on one specific page.

Regarding the version number, I always get the page information first and add 1 to the version number when I want to do the update.

Regarding the history, when I check the settings of my page, I still have the version number before the update. It's not changing.

Best regards

Like Dominic Lagger likes this

Hey @Dominic Lagger ,

I solved my issue by used the function UrlFetchApp.fetch and used "payload" options instead of body in the request.

Thanks for your help.

Like Dominic Lagger likes this

Suggest an answer

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

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

199 views 1 3
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