API permissions issue with Team-managed software

Hello,

I am working on a Jira integration and am having a problem creating an issue on projects that are created with a setting of “Team-managed software”. I am using @forge/api to attempt to create the issue:

  const response = await api.asApp().requestJira(route`/rest/api/3/issue`, {
    method: "POST",
    headers: {
      Accept: "application/json",
      "Content-Type": "application/json",
    },
    body
  });

This works perfectly on any type of project where the software is “company-managed” however when I try this on a “team-managed” project I get the following errors from the API:

  errors: {
    summary: "Field 'summary' cannot be set. It is not on the appropriate screen, or unknown.",
    description: "Field 'description' cannot be set. It is not on the appropriate screen, or unknown.",
    assignee: "Field 'assignee' cannot be set. It is not on the appropriate screen, or unknown."
  }

My limited internetting has led me to believe this is a permissions issue, can anyone confirm if they’ve run into this before? Is there something I’m missing in how I’m making the API call?

Thanks for your time :wave:

Hi @aaron1,

Most probably you are using non-existing issue type id for the given project as by default team managed projects don’t have a story type (and few others). Could you please double check it?

Thanks,
Vitalii

Thanks @vpetrychuk, that must be the issue. Can you clarify how to determine what projects have access to what issues? I see a scope attribute when retrieving /rest/api/3/issuetype, however not all issue types have this attribute:

[
  {
    self: 'https://api.atlassian.com/ex/jira/ec1db2a6-1b99-486b-b02a-2ade80170092/rest/api/3/issuetype/10038',
    id: '10038',
    description: 'Epics track collections of related bugs, stories, and tasks.',
    iconUrl: 'https://api.atlassian.com/ex/jira/ec1db2a6-1b99-486b-b02a-2ade80170092/secure/viewavatar?size=medium&avatarId=10307&avatarType=issuetype',
    name: 'Epic',
    untranslatedName: 'Epic',
    subtask: false,
    avatarId: 10307,
    hierarchyLevel: 1,
    scope: { type: 'PROJECT', project: [Object] }
  },
  {
    self: 'https://api.atlassian.com/ex/jira/ec1db2a6-1b99-486b-b02a-2ade80170092/rest/api/3/issuetype/10002',
    id: '10002',
    description: 'A small, distinct piece of work.',
    iconUrl: 'https://api.atlassian.com/ex/jira/ec1db2a6-1b99-486b-b02a-2ade80170092/secure/viewavatar?size=medium&avatarId=10318&avatarType=issuetype',
    name: 'Task',
    untranslatedName: 'Task',
    subtask: false,
    avatarId: 10318,
    hierarchyLevel: 0
  },
  ...
]

Are there some projects that have access to any issue type, or is scope always a factor? I haven’t found reference to this yet in the docs, any pointers would be appreciated :pray:

Just to follow up on this, I can get the list of issues for the project with the v2 API (/rest/api/2/project/${projectKey}), though this doesn’t seem ideal.

Is there a similar way via the v3 API to accomplish the same result? It’s not obvious to me scanning through the docs.

Thanks again :pray:

Glad to hear it works, @aaron1! Check GET /rest/api/3/issuetype/project

Thanks,
Vitalii

1 Like