Is it possible to make request from one Jira Cloud to another?

Hello everybody,

I have little knowledge but i am working on it :slight_smile: So please be gentle :stuck_out_tongue: .
I would like to know if its possible to do a request to another jira cloud instance from a current working one. For example, is it possible this to work?

const fetchProjects = async (otherInstanceUrl) => {
   const result = await api.fetch(`${otherInstanceUrl}/rest/api/3/project/`)
  
  console.log(`Response: ${result.status} ${result.statusText}`);
  console.log(result.json());

  return result.json()

The logs Response is 200 OK, but it returns me 0 projects while there are already 2. In both instances Dev and the other one i am SiteAdmin :confused:

Regards
Christos

Hi @christos.moysiadis,

The Connect framework is inherently single tenanted. Each installation only authorized access to a particular tenant. However, it is possible to mix tenant API calls from the back end of a Connect app so long as it’s been installed into all the tenants it attempts to make API calls against and using the credentials for those tenants. For example, for your code snippet above, the fetch to otherInstanceUrl will work if your connect app has been installed in the tenant corresponding to otherInstanceUrl and with a JWT encoded with the shared secret provided when the app was installed in the tenant corresponding to otherInstanceUrl. It seems the API call to /rest/api/3/project is returning no results due to lack of permissions caused by using the wrong credentials. You could also simulate this in a browser without an active session to the tenant just by visiting the URL: https://otherinstance.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-get

Your app can also make API calls from app iframes embedded in Jira using AP.request, however, these calls can not be made cross tenant.

Regards,
Dugald

2 Likes

Hi @dmorrow,

thank you a lot for the explanation! I spent so much time to understand the problem and it was quite obvious. It makes absolute sense now :slight_smile:.
I will try to make these fixes and see the results :slight_smile:

Best Regards
Christos

1 Like