Forums

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

How can I get JIRA macro's value while calling confluence rest API ?

Rinkal Patadiya
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 12, 2020

I am trying to get jira macro's value in confluence rest API but the macro's value is blank in confluence content page. I am using below api for that purpose.
http://localhost:8080/confluence/rest/api/content/search?cql=space=DEV%20AND%20label=docs&expand=body.view.value

Can anyone help me in that ? Is there any authentication required for jira permission or such kind of stuffs needed?Screenshot from 2020-03-11 15-55-57.png

1 answer

1 accepted

0 votes
Answer accepted
WW
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.
March 20, 2020

If the Jira data is not showing up for you in Confluence, then here could be a few things going on.

1. User doesn't have view access to the projects or issues (or Jira for that matter)

2. JQL for the macro is not returning issues because of incorrect syntax/JQL or there are just no matching issues.

3. There is no OAuth token setup for the user between Confluence and Jira.  Below tells all I know about this topic...

Usually with Jira macros (or macros that connect to other applications), in the UI the user has to click a button saying that s/he allows Confluence to access to Jira (or other application).

This creates an OAuth token between for the user between Confluence and Jira/app.  You can see your tokens under Profile | Settings | View OAuth Access Tokens

image.png

 

The applications you've allowed Confluence to connect with will appear under here:

image.png

On the Jira side it'll be under:

image.png

Jira may have more relationships listed if you have plugins, so you'll look to see if you have one that starts with "Confluence."

 

I honestly don't know how to created that OAuth connection using the Jira Server REST API. I'm not sure if it's possible with the Jira Server REST API (or maybe with another REST API like Crowd?). 

You need to make sure each user has the Jira OAuth connection established.  The only way I know of (easily) to do that is to tell the users to go into edit mode on any page, create any Jira related macro, and when they see the screen shown below, to click on the button. (After the approval is given, they can click cancel so they don't actually create the macro.)

image.png

The window below appears, but once you click Allow, it goes right back to your Insert Macro window.

image.png

Hopefully something on here points you in the right direction!

Suggest an answer

Log in or Sign up to answer