Making a Jira rest call from a confluence app

Hi everyone,

I am looking for a way to make a JIRA REST API call from within my confluence CLOUD app.

There are some topics in this forum but i cant really work out anything with the answers posted there.

for example:
I want to have a confluence cloud macro that gets all jira projects, so i would need my macro to call this endpoint: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-projects/#api-rest-api-2-project-get

but i somehow get errors when trying to do so in any component in my frontend (directly in the macro) (CORS ERROR).

But when executing the call from within the browser (console), I do not receive any errors.

What am i doing wrong and what would be the correct way to execute the jira rest api endpoints from a confluence cloud app (macro) ?

I do have a CONNECT app , no forge!

I would love a minimal working example regarding this.
It doesnt even matter if i have to call it from the front end or back end, i just want to somehow make it work to execute jira rest api calls from my confluence cloud app.

Hi @Musa,

Have a look at this method below. It should hopefully get the job done for you!

https://developer.atlassian.com/cloud/jira/platform/jsapi/request/

1 Like

That won’t work for me, the request gets CORS blocked.

1 Like

Hi, that’s a CORS error, so you’ll have to do the request on your backend.

Here is an outline of what we did for our plugin.

  • We created a second app for Jira.
  • After the Jira app is installed, the users can link a Confluence and a Jira app. The client keys, secrets, base urls are different.
  • When receiving a request from the Confluence app for Jira data, we proxy the request with the appropriate secret from the linked Jira app installation, using user impersonation.

Alternatively, you can use Basic auth for REST APIs, and have the user provide your app with a valid JIRA API token.

Hi,

Thanks for your suggestion,
the more user friendly way would be without having to install an additional app so i am going to further try out that first.