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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • 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

Creating A New Page Using Confluence Rest API That Has Embedded Tabs Within It

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.

1 answer

0 votes
Chii Atlassian Team Aug 20, 2019

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. 

Suggest an answer

Log in or Sign up to answer
TAGS
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...

463 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