Forums

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

atlassian-python-api update_page call works on some pages but not others

jkessler
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 11, 2023

I have a workflow where a user passes in a link to a Confluence page and I try to replace a string in the HTML with an updated string. I get the page ID, create a Confluence connection, and then my code looks like this:

page = confluence_connection.get_page_by_id(id, expand='space,history,body,body.view,version,ancestors', status=None, version=None)
content = page['body']['view']['value']
new_content = content.replace(old_string, new_string)
confluence_connection.update_page(page_id, page['title'], new_content)
The target string I'm replacing is something like "This link hasn't been updated" and the new string is a new link. On some pages, the update works. On others, after the update, I get the message:

We’ve hit a snag

The issue should resolve on its own, but if it keeps happening, ask your admin to contact our support team and give them:

  • The URL of this page
  • The code associated with this error: an2bkm
Refresh page

I did notice that after the update for the pages that fail, there's HTML in page['body']['storage']['value'] but there's nothing in page['body']['view']['value']. Nothing immediately jumps out at me as being different between the pages that work and those that don't. I'm wondering if the expand params I'm passing into get_page are wrong, I need to add some additional value to the update_page call, or if I need to pass something slightly different for new_content.

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
September 7, 2023

Hi @jkessler , 

I work with that wrapper. 

if it's still actual please create issue in github. 

Looks like I will need a debug logs

 

Cheers,

Gonchik

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events