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

hey there.

we’re trying to create ideas through our forge app, but for some reason the forge app doesn’t see the Product Discovery projects when trying to createmeta to get the field configuration.

we’ve tried the following:

/rest/api/3/issue/createmeta?projectIds=whatever&projectIds=whatever

/rest/api/2/issue/createmeta?projectIds=whatever&projectIds=whatever

to debug – we’ve also tried to remove all filters, but even then we only see projects that are not Product Discovery. so it seems like those project types are invisible to our createmeta calls.

we’ve also tried to do this:

/rest/api/2/issue/createmeta/${projectId}/issueTypes/${issuetypeId}

but in this case, the api tells us: “OAuth 2.0 is not enabled for method”. we’re pretty sure this used to work and we haven’t changed the code on our side. is this to be expected? what can we do?

we also have an integration that works based on a normal oauth flow (authenticating as a user, not as forge app), and there it does work – we can see product discovery projects and also post ideas.

any input would be appreciated.

martin

1 Like

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

hey dugald, thank you so much for your answer.

there’s one major difference between your example app and our application – we don’t have a user context (because it’s an automation doing this), so we call the api with asApp() and not with asUser().
could that be the reason for us not seeing any product discovery projects? we also noticed that with our other integration, where we do have a user, it is possible to post issues/ideas to JPD.

martin

2 Likes

Hi @MartinSereinig ,

Thanks for your response. I think I understand now. Each Forge app is associated with a system user which seems not to be given JPD permissions when the app is installed for Jira for a given site (e.g. yourtenant.atlassian.net) like it is for other Jira products in the site such as Jira Software.

I’ve created FRGE-1284: Forge app users do not have JPD project permissions to fix this.

Regards,
Dugald

3 Likes

thanks a lot @dmorrow !

@MartinSereinig,

I know you might still be stuck because of the JPD project permissions, but now you should also know about the Create Issue Meta Endpoint Deprecation.

With a couple new endpoints to help fill in the gap, there is an endpoint for “issue types by project”:

Get create metadata issue types for a project: fetches all Issue Types for a specific Project; it will support pagination on the Issue Types, but not include expanded fields