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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to have a html link update the data on an existing confluence page? Edited

I have a python code that's updating an existing confluence page with some data. I want to include a html link/button for users so that when they click this on confluence page it would trigger to make a call in the backend python code for  jenkins API for job build and update with the new data on confluence page. 

I know how to make API call using requests in python code for jenkins api and get the data but how can I hook this html link with python function that would trigger this api call? Is it possible ? Or do I have to use Ajax or something else?

Here is payload for my confluence API to update page where data is a var containing html string. 

payload = {'id': page_id, 'type': 'page', 'status': 'current', 'title': 'Report', 'space': {'key':'XXXX'}, 'ancestors':[{'id':parent_page_id}], 'body': {'storage': {'representation': 'storage', 'value': '<p><b>This page is auto-generated. In case you want manually update this page click </b><a href="url">here</a></p>' + data}}, 'version': {'number': existing_version, 'minorEdit': 'true'}}


1 answer

To update a Confluence page you'll want to use the Update content REST API. To use the API you will either need to build a Connect App or generate an OAuth2 Token for your existing app.

If you have questions about this you should post on the Atlassian Developer Community. :)

Thank you @Sven Schatter _Lively Apps_ for the reply . I understand that and I'm already using update content API to update with the static data being pulled from other apis and update here on an existing page. However, my question/query as per my post was regarding introducing a hyperlink and how to implement the action of hooking up this link to perform a POST of another api request that would get the data based upon whenever user clicks this link.

I'm getting the idea that I would have to use Ajax but not sure if there are any example one could point to for this case.

I can post on developer community as well. 


You could make a web server out of your python script and create a REST API that calls your existing code. So let's say if someone visits the URL your script will run and update the page with the id 123456. This link could then be embedded into a Confluence page. However this poses somewhat of a security risk as you would need to make your REST API available without authentication. That means everybody with the link could update your page, even if they don't have access to your site. It is also not very user friendly because the page id needs to be filled in on each page manually.

Generally it sounds more like you should build a macro using the Connect Framework. Using a macro you could execute an authenticated AJAX call to your server. The macro could also automatically pick up the page id of the current page and you could even present your functionality in the form of a shiny button instead of a boring link! :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

494 views 24 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you