Issue with forge while using Jira rest API

Hello experts,

I’m using forge to develop a confluence macro while using jira rest api

but can not get any response well

/resolver/index.js

import Resolver from "@forge/resolver";
import api, { route } from "@forge/api";
import { requestJira } from "@forge/bridge";

const resolver = new Resolver();


resolver.define('submit', async (req) => {
  const { jql, domain } = req.payload;
  console.log('Received JQL:', jql);
  console.log('Received Domain:', domain);

  // Make the Jira API request
  const response = api.asUser().requestJira(
    route`/rest/api/3/search?jql=${jql}&maxResults=500`,
    {
      method: 'GET',
      headers: {
        'Content-Type': 'application/json',
      },
    }
  );
  console.log('Jira API Response:', response);

});

export const handler = resolver.getDefinitions();

tunnel debug found that the fetch.js file give the wrong url as below

Note:

  1. I’m using the develop cloud site debug “https://isuntest.atlassian.net/
  2. expect url https://isuntest.atlassian.net/rest/api/v3/seach
  3. scopes use read:jira-work

What I got wrong url?

Hi @IssacSun ,

You won’t be able to invoke the Jira REST API from a Confluence macro because Forge doesn’t support cross product apps.

Regards,
Dugald

@dmorrow That is incorrect.

If you install you app on both Jira and Confluence, then you can call the Jira REST API from you Confluence macro.
Our app is doing that every day for the last 2 years ;).

What is correct, is that the Atlassian Marketplace does not support cross product apps yet.

1 Like

Hi @FabienLydoire ,

Thanks for pointing this out. I didn’t realise REST API calls are allowed from a Forge app to a workspace it wasn’t installed in.

Regards,
Dugald