Hi there,
I have been able to create a confluence page using confluence rest APIs. All good so far.
However, I'd like to evolve this and create a page with embedded tabs. Outside of confluence this is trivial to do as you can use html plus css (with javascript if you like although not mandatory). I know their are plugins that create tabbed content but the plugins I have installed don't have a rest api equivalent AFAIK.
My questions are as follows:
1) Is it possible to add my own custom stylesheet via the rest API so to style the html I send?
or
2) When sending my html could I set the class attribute to a certain value so that the confluence server would know to interpret this to be tabbed page content on that page?
or
3) Is there an sample code that is achieving my objective above?
Thanks in advance as to any help regarding the above.
When you are using the REST api to create content, you are not sending HTML, but sending confluence storage format. It acts like HTML, but it is not, and you will not be able to directly send any style sheet tags either.
You need to find and install a plugin containing a macro that displays tabbed content, and send storage format that correspond to that macro in your REST api call. You can find out what the storage format looks like for the tabbed content macro by installing the source editor plugin (https://marketplace.atlassian.com/plugins/com.atlassian.confluence.plugins.editor.confluence-source-editor) and manually creating the page in the editor, then view the source.
If you really want to send HTML directly, and style it with a style tag, you can use the "html" macro (see docs here https://confluence.atlassian.com/doc/html-macro-38273085.html). This is a dangerous macro to enable, as it is basically an open XSS vulnerability - anyone who has edit permission to the page can add any HTML.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.