You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
I'm trying to append content to an existing confluence wiki page. So far, I can see only PUT exists and it overwrites the whole page.
I also tried to pull the existing content, then append the changes automatically locally and then push again but for some reason, all the emojis/icons replaced with a blue star...
Extract data for edit:
response = requests.get("https://<compnay>.atlassian.net/wiki/rest/api/content/" + page_id + "?type=blogpost&start=0&limit=10&expand=body.view",
auth=(email, apitoken), verify=False)
The PUT code example:
new_headers = {
'Content-Type': 'application/json',
}
data = r'{"id":"' + page_id + '",' \
'"type":"page",' \
'"title":"' + page_title + '",' \
'"space":{"key":"' + workspace + '"},' \
'"body":{"storage":' \
'{"value":"' \
'' + full_code + '<p />",' \
'"representation":"storage"}},"version":{"number":' + str((int(version_number) + 1)) + '}}'
response = requests.put('https://<company>.atlassian.net/wiki/rest/api/content/'+page_id, headers=new_headers,
data=data, auth=(email, apitoken))
Which brings up 2 questions:
More Important: How is it possible to append content to an existing wiki page, without overwriting or deleting the existing content within it?
Less Important: Why the emojis changed to blue star? How can I avoid it?
Hi!
@Gadi Tabak could you fetch in &expand=body.storage instead of
&expand=body.view
?
Then you can do concatenation and push data.
I hope next example will help you
https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/confluence.py#L1217
https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/confluence.py#L1276
Cheers,
Gonchik
Well, it seems I was checking body.view instead of body.storage the whole time. This is the source to my mistake.
What I eventually did is to fetch the data from body.storage, then manipulated it with re Python library and sent it again to modify the page.
Thank you Gonchik for giving me this lead.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond. A long time favorite, Team Cale...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.