Forums

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

Update confluence page using rest API

Naveen Kumar_Appfire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 30, 2021

Hi team,

I wanted to edit the page and add some content to the page without deleting/removing the old content which is present on the page using rest API.

Could you please help me to achieve this using REST API?

Thanks,
Naveen

 

2 answers

0 votes
David at David Simpson Apps
Atlassian Partner
September 30, 2021

First, you need to get the existing content using the REST API.

More details here:
https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-get 

 

Then you need to append the new content to the end of the page and save it back

More details here:
https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-id-put

Also take a look at this previous question for some more help:

https://community.atlassian.com/t5/Confluence-questions/Append-content-with-Python-to-an-existing-Wiki-Page-via-REST-API/qaq-p/1509335

Naveen Kumar_Appfire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 30, 2021

While appending the content to the confluence page using the above REST API URL you have shared, Getting the below error.

{
"data": {
"authorized": false,
"errors": [],
"successful": false,
"valid": true
},
"message": "com.atlassian.confluence.api.service.exceptions.BadRequestException: Content body cannot be converted to new editor format",
"statusCode": 400
}

0 votes
Kishan Sharma
Community Champion
September 30, 2021

Hi @Naveen Kumar_Appfire 

Have you already tried the example given in the REST API documentation for confluence cloud ? You can try it first on a sample page to see how it works. If you are facing any issues please post here, will be glad to assist.

Naveen Kumar_Appfire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 30, 2021

@Kishan Sharma

Tried that and getting the below error.
{
"data": {
"authorized": false,
"errors": [],
"successful": false,
"valid": true
},
"message": "com.atlassian.confluence.api.service.exceptions.BadRequestException: Content body cannot be converted to new editor format",
"statusCode": 400
}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events