Python append_page overwriting

Tanase Silviu April 18, 2024

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.

2 answers

1 accepted

0 votes
Answer accepted
Humashankar VJ
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.
April 23, 2024

HI @Tanase Silviu 

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!!

Tanase Silviu April 25, 2024

Hi @Humashankar VJ , thank you again for support. It seemed that the problem wasn't the Confluence Python API but the current artifacts used in Gitlab.

Like Humashankar VJ likes this
Humashankar VJ
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.
April 25, 2024

Hi @Tanase Silviu 

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.

Tanase Silviu April 25, 2024

Yes, I'm already on it. There is no problem from Confluence.

Like Humashankar VJ likes this
Humashankar VJ
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.
April 25, 2024

Awesome !!

0 votes
Humashankar VJ
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.
April 19, 2024

Hi @Tanase Silviu 

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/

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

Tanase Silviu April 23, 2024

Hi @Humashankar VJ

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.

Like Humashankar VJ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events