Confluence blueprint - call to Jira API

Hi,

I’m building a confluence plugin which makes an API call to Jira to get a list of customers on our Service Desk. This data gets parsed and plugged into a dropdown on a blueprint we’ve built. I’ve done this by using an ajax call to the applinks proxy (/plugins/servlet/applinks/proxy?appId=…). I’m getting the applink id using an ajax call to (/rest/applinks/1.0/listApplicationlinks").

Now this all works wonderfully if I’m logged in as an administrator, however, if I’m logged in as a regular confluence user my applink calls are pulling back a 401 unauthorized error. I’ve done alot of reading around community posts/tutorials to try find a way to authorize the regular logged in user so that I can make the applink calls to Jira but haven’t had any joy.

Ultimately I want to make an API call from Confluence to Jira to get some Json data using some form of authentication. I’d appreciate any guidance or a steer in the right direction.

Hi @gary.cunningham,
maybe this answer could help: https://community.atlassian.com/t5/Answers-Developer-Questions/Re-How-to-create-JIRA-issue-from-Confluence-plugin/qaq-p/505913/comment-id/43568#M43568
At least, it was helpful for me. :wink:
You may can get your url like this: String url = jiraLink.getRpcUrl() + "/rest/MyRestResource";
Do you provide an own REST resource from JIRA? If yes, do you (hypothetically) query projects your users do not have permissions to? So - just maybe - the 401 is correct? :wink: Then you should user the method SearchService::searchCountOverriderSecurity, if you know what you are doing.
Best regards
Alex