Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,691
Community Members
 
Community Events
165
Community Groups

How to store data entered in the HTML Macro

Hello,
I create a simple HTML, JS code, embedded via the HTML Macro.
The user is supposed to enter some data, what works like charm.

How can I store this data server-side to ensure that is available the next time, the user opens this space.

thank you

Stefan

1 answer

0 votes

Hello Stefan,

Your question is a great question and it points to how versatile Confluence is capable of being. Within the HTML macro itself, you will need to use PHP within there to make API calls to endpoints to ingest the inserted data. There are multiple guides that will walk you through on how to use PHP and a REST API together. A great and detailed guide may be found at How To Create A Simple REST API in PHP? Step By Step Guide!

Along with this, there is a guide on how to use PHP within Confluence using the HTML macro. That guide may be found at How to use PHP inside Confluence pages.

I hope this proves helpful and you’re able to start ingesting some of your user content via the REST API.

Regards,
Stephen Sifers

Hoi Stephen,

thanks for pointing me in the PHP direction but that requires not little work(around) to get it done. Isn't there any possibility to make use of Confluence's APIs?

Hello Stefan,

HTML by itself does not directly work with REST API POST/PUT calls due to the requirements of authentication. With this said, you will need to use something such as PHP to allow for triggers which then authenticate and make the authenticated REST API calls to Confluence (Or any other service you want to update).

Another alternative would be to use Javascript, but the entry point for PHP is simpler than Javascript. Mainly due to simplified working examples of how to make REST API calls with PHP readily available.

Regards,
Stephen Sifers

I agree that PHP could be simpler in the long term but JS can be inlcuded easily, PHP needs an extra server.

Hi,

This is good information, but do we need to have PHP installed in the Confluence Server? It seems that with JS we might not need to install anything extra in the server itself. Please let me know if I am incorrect here.

Thank you,

Roberta

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

219 views 1 4
Read article

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