Python append_page overwriting
Asked by Tanase Silviu:

Trying to append release notes on Confluence page via Gitlab with python script.  
There is a possible bug regarding to the confluence.append_page function:

The latest deploy has overwritten the previously one data on the page:  

confluence.append_page(

page_id=page_id,

title=page_title,

append_body=macro_template,  
minor_edit=False

)  
I would like to find out some resources regarding to the append_page function possibilities to overwrite something on the actual Confluence page.


Answers:
author: Humashankar VJ
body: HI [@Tanase Silviu](/t5/user/viewprofilepage/user-id/5479151)

You got it right, Confluence doesn't require a separate REST API installation to achieve what you're trying to accomplish

While the Confluence REST API exists, it's not a separate installable component. It's the underlying API that the Confluence Python library interacts with

**The Confluence Python API** you are using provides the necessary functionalities to interact with Confluence.

This is a valid and efficient solution. You can continue using the from atlassian import Confluence import statement to interact with Confluence programmatically.

The library offers functionalities to create, update, and manage Confluence pages

Best Regards!!

comments: author: Tanase Silviu
body: Hi [@Humashankar VJ](/t5/user/viewprofilepage/user-id/5409474) , thank you again for support. It seemed that the problem wasn't the **Confluence Python API**but the current artifacts used in Gitlab.


author: Humashankar VJ
body: Hi [@Tanase Silviu](/t5/user/viewprofilepage/user-id/5479151)

If it is in your GitLab pipeline, then lets look in to GitLab artifacts involved in the deployment process  
whicih might be overwriting the previous release notes on the Confluence page unintentionally

Can you give a try with different artifact paths or versioning mechanisms within GitLab to avoid overwrites.


author: Tanase Silviu
body: Yes, I'm already on it. There is no problem from Confluence.


author: Humashankar VJ
body: Awesome !!


author: Humashankar VJ
body: Hi [@Tanase Silviu](/t5/user/viewprofilepage/user-id/5479151)

You are right -- the function in the Confluence Python API is designed to append content to an existing page, not overwrite it.

**You can try other possibilities like Confluence REST API to update a page with new content**

* First, fetch the page's current content using the GET endpoint.
* Next, add your release notes to the existing content.
* Finally, use the PUT endpoint to update the page with the combined content, which now includes both the original information and your new release notes.

[confluence/REST/6.6.0/](https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/)

**Hope this helps - Happy to help further!!**   
**Thank you very much and have a great one!**   
**Warm regards**

comments: author: Tanase Silviu
body: Hi [@Humashankar VJ](/t5/user/viewprofilepage/user-id/5409474)

Thank you for these advices, but I found out that I don't have Confluence REST API in place, so we have to resolve this bug only via provided confluence module by Confluence Python API via importing the following module: from atlassian import Confluence  

The other solution is to put in place Confluence REST API.  
Can you confirm these? If I understood the above correctly, then you can close this ticket.  


Tags: cloud

confluence-cloud

python