REST API to get issue types of given project ?

Jegan Gopalakrishnan December 21, 2018

Hi 

 

I am trying the get the issue types using the REST API. I tried the below two APIs. 

 

  1. /rest/api/2/project/{projectIdOrKey}
  2. rest/api/2/issue/createmeta?projectKeys=XXX

 

In both the API result, i am getting 11 issue types. But in actual JIRA UI, I am seeing only 5 issue types.

 

 Is there any REST API available to get only the issue types displayed in the JIRA UI ? Any suggestion on this issue is really appreciated. Thanks in advance.

 

2 answers

2 accepted

1 vote
Answer accepted
Brian Clawson July 5, 2019

The project API may be an easier way of getting the issue types:

GET /rest/api/2/project/{projectIdOrKey}

This allows you to pass the Project Key and get back most of the metadata about the project including the available issue types

Puneet.Shanbhag March 25, 2021

@Brian Clawson 

I was looking for Project Issue Types API for quite some time, just like project component and then I run through your suggestion .. thanks mate this solved my requirement

0 votes
Answer accepted
Tom Lister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 22, 2018

Hi @Jegan Gopalakrishnan

I wouldn’t  expect either of those calls to return a list of issues

try

/rest/api/2/search?jql=project=“Project Key"

 

https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+Query+issues

Jegan Gopalakrishnan December 26, 2018

Hi @Tom Lister,

Thanks for the quick response. The API that you suggested, gives the list of issues under the project. I am looking for "issuetypes" : list of issuetypes available while creating the JIRA. 

Please let me know if you need any details on the issue. Thanks.

Like agilbert likes this
Tom Lister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 27, 2018

Hi @Jegan Gopalakrishnan

use

http://localhost:8090/rest/api/2/issue/createmeta?projectKeys=FRO3&expand=projects.issuetypes.fields

you will get the list of issue types available in a project and within the issues a list of fields available and their types  including whether they are mandatory. For select lists the allowed values are shown. This is the most complete information available and is the meta data required fro creating an issue.

Like # people like this
Jegan Gopalakrishnan December 27, 2018

Hi @Tom Lister

Thanks for getting back to me on this. I tried your API. In that response also, I got required: "true" for all the 11 fields. 

 

"fields": {

"required": true,

...

}

 

Will there be any other reason, why I am unable to see all the 11 fields in the UI ? 

Tom Lister
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 27, 2018

Hi Jegan

What do you mean by UI? The view screen for issues?

Fields will only be shown if they have values. JIRA doesn't have any custom field value entries for fields until they exist for the specific issue.

My REST data shows a mixture of fields required and not required. I have no reason to believe it's not accurately reflecting the underlying configuration. If you think it's wrong that would be an Altassian support issue.

Jegan Gopalakrishnan December 28, 2018

Hi Tom,

Thanks for helping me out. Will check with support regarding the issue in our Jira server. 

Suggest an answer

Log in or Sign up to answer