Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I automatically update images on a confluence page?

Jeff Abbott May 10, 2020

I use Excel to periodically generate a set of pivot charts from various relational databases. I am able to write a .png file to disk each time each chart is updated, and have control over the file names that are created.

How can I update a confluence page/dashboard so that the new images are loaded automatically (the latest images are always displayed)?

3 answers

1 accepted

2 votes
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2020

You'll need to use the REST API to attach new versions of the files when updated, then use a simple "display image" macro to display "latest".  Your users will still need to refresh the page.

Jeff Abbott May 11, 2020

Thanks, I'll look in to this approach.

Jeff Abbott May 14, 2020

Ok, I have the images loading via REST, but I can't update them. My curl command line options are:
-o nul -w "%{http_code}" -u [username]:[pwd] -X POST -H "X-Atlassian-Token: nocheck" -F "file=@[path]" -F "minorEdit=true" -F "comment=Added by VBA macro through REST API."

I understand I need to handle the revisions, but I don't know how to do that.

Jeff Abbott May 14, 2020

I answered my own question:

curl -D- -k -u $user:$pwd -p -H "X-Atlassian-Token: nocheck" -X POST \
 -F file=@filename https://confluence.domain.tld/confluence/rest/api/content/$page_id/child/attachment/$attach_id/data
0 votes
jcasarrubias September 28, 2021

Hello @Jeff Abbott 

Sorry for asking, how do you write a .png file to disk each time each Excel chart is updated ?

Regards,

JLuis

0 votes
Anton March 22, 2021

Hi Jeff,

Thanks for your question and answer. Very helpful indeed. 

I use the same curl to update images on my Confluence pages. Ever since the new Confluence editor I get the error “Fail to load” on the images. Is there something different I need to do with my curl command? If I update the images manually I have no problems.

Thanks in advance!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events