Jira Product Discovery: limitations for Forge app when calling createmeta?

Hi @MartinSereinig ,

I suspect this might be a permissions problem because I created the following test app which is able to call the /rest/api/3/issue/createmeta API:

manifest.yml

modules:
  jira:issueAction:
    - key: forge-jpd-test
      function: main
      title: Forge JPD Test
  function:
    - key: main
      handler: index.run
permissions:
  scopes:
    - read:jira-work
app:
  id: ari:cloud:ecosystem::app/xxxxx

index.jsx*

import ForgeUI, { render, Text, IssueAction, ModalDialog, useAction, useState } from '@forge/ui';
import api, { route } from "@forge/api";

const myProjectId = '10001';

const App = () => {

  const [isOpen, setOpen] = useState(true);

  const getCreateIssueMetadataData = async () => {
    const getCreateIssueMetadataData = await api.asUser().requestJira(route`/rest/api/3/issue/createmeta?projectIds=${myProjectId}`, {
      headers: {
        'Accept': 'application/json'
      }
    });
    console.log(`getCreateIssueMetadataData status: ${getCreateIssueMetadataData.status}`);
    const data = await getCreateIssueMetadataData.json();
    console.log(`typeof data = ${typeof data}`);
    return data;
  }

  const [createIssueMetadataData] = useAction(value => value, async () => await getCreateIssueMetadataData());

  if (!isOpen) {
    return null;
  }

  return (
    <ModalDialog header="Hello" onClose={() => setOpen(false)}>
      <Text>{JSON.stringify(createIssueMetadataData, null, 2)}</Text>
    </ModalDialog>
  );
};

export const run = render(
  <IssueAction>
    <App/>
  </IssueAction>
);

Note that the hard coded project ID of 10001 was only to keep the test as close to your test case as possible and this project ID is a JPD project. The app successfully returns the JPD project’s create metadata response.

Regards,
Dugald

1 Like