Hi there,
how to get initial status of issue?
I need to inform user what is initial status of Jira issue when creating Issue. I know project ID/Key and Issue Type. I need to know this initial status before I create the issues.
I found Get all statuses for project which retrive all statuses for each issue type in specific Project, but not sure how to detect the initial status of issue type.
Thank you
Hi @janambroz,
For this use case, you can get the information you need by calling the Get workflows paginated REST API and expand statuses
, transitions
, and projects
. In the response, check for the transition of type initial
and look for the initial status being pointed to by to
. For example:
# Request
GET /rest/api/3/workflow/search?expand=statuses,transitions,projects
# Response
"transitions":
[
{
"id": "1",
"name": "Create",
"description": "",
"from":
[],
"to": "10013", # this fellow over here
"type": "initial"
},
...
],
"statuses":
[
{
"id": "10013", # points to here, the initial status after creation
"name": "Review"
},
...
],
"projects":
[
{
"id": "10004",
"key": "AP",
"name": "Asset Project",
"projectTypeKey": "service_desk",
"simplified": false,
...
}
]
Hope this helps.
Ian
Hi @ianRagudo,
that helps thanks!
And is there a way to return this workflow details just for one specific Projectby Projectr ID or KEY?
Thanks!
Happy to help, @janambroz.
There is an API that accepts a projectId
(requires an issueTypeId
as well) - check out Bulk get workflows - but this is currently tagged as experimental.
A sample request body will look like
{
"projectAndIssueTypes":
[
{
"projectId": 10000,
"issueTypeId": 10000
}
]
}
Cheers,
Ian