Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to display inline values from Jira REST api into confluence

Tom September 9, 2020

Hello everyone,

 

My goal is to display the value of a Jira REST query result into a confluence page, inline with the text. I am aware of the /jira macro but that does not cut it as it renders ugly gray boxes that break the line.

 

Here an example of what I'd like to see in confluence and how in my head i'd like to get it done:

 

In my confluence page I've the following sentence as normal text:

  • "The value of the field is value"  - I'd like for the world value to be dynamically generated based upon the value of a Jira issue field.

The way i dream for this to work is:

 

Now this would get me the value of the field id: 123456 from the REST api for project PRJ-1 and display it as text in confluence.

 

What i don't want:

  1. Text displayed in tables that messes up the layout,
  2. text rendered by the /jira macro that disrupts the layout and doesn't sit in line with my paragraph,

 

Any direction is appreciated since i am new here and i am losing my mind around macros and other articulated concepts. Just some simple JSON parsing, HTLM, CSS or running some JS/Python somewhere would relieve my stress.

Thanks

1 answer

0 votes
Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2020

The out-of-the box Jira macro for Confluence returns values in tabular format. You're going to need something like ScriptRunner do to the REST based lookup behind the scenes and return some raw text that you can put on the page.

Alternatively, third party tools like the Stiltsoft Table Filters can manipulate the heck out of the data returned by the Jira macro and format it in all sorts of way on the Confluence page.

Tom September 14, 2020

Hello,

I appreciate you taking the time to respond. Table filters seems to be doing just tables (as the name suggests) which is not very useful, unless you want to display data...in a table.

I've inquired Script Runner support, although from their description while it is evident you can query the Jira Api, it is unclear how much you can manipulate and display on confluence.

Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 14, 2020 edited

Yes, the output from the Stiltsoft Table filter will still be a table, but if you render the table with no borders, cell padding or colours, nobody will know it's there, all they'll see is the text. The table becomes an invisible container for the text, so it's the simplest solution. Still, in HTML, tables aren't truly inline with text

If you absolutely need the output in that table as text, inline in the page body, you might have to do some browser side page content manipulation with something like JQuery to 'unwrap' the content from the table and put it back in the same place.

The last resort would be to use ScriptRunner to get the value you want, but you'd have to write your own Confluence macro to take that value, put it inside the text, then render it on the page... but then you face a similar issue; macros get treated as separate objects on the page and can't just be inserted inline in any text, anywhere.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, confluence whiteboards, whiteboard templates, template contest, visual collaboration, atlassian learning, confluence community, brainstorming tools, agile planning, team productivity, confluence templates, share your template

Share Your Confluence Whiteboard Template for a Chance to Be Featured in the Product! 🏆

Want to leave your mark on Confluence? One winner will have their whiteboard design added into Confluence for all users to access! This is your chance to showcase your creativity, help others, and gain recognition in the Confluence community.

Share your template today!
AUG Leaders

Atlassian Community Events