Status of created Issue

Hi there,

I am trying to identify what will be the status of new created issue. I understand that when I am creating Issue via API I can not change status, and it will be assign based on workflow.

So is there a way to identify status for a new issue without creating an issue?

Base on /secure/admin/ViewStatuses.jspa I can assume that the first status is status which is assigned to created Issue? If yes, is there a way to get this info via API?

Thank you

Hi @janambroz,

Yes, the newly created issue will have the status based on the associated workflow.

If you are working with company-managed projects, you can try Get workflows paginated REST API and expand the following:

  • transitions - so that you can check what status Create transition points to
  • status - to help map the status
  • projects - the issue you are to create could have different workflows and statuses depending on the project, expanding this can help you map accordingly

Sample response for GET /rest/api/2/workflow/search?expand=statuses,transitions,projects&maxResults=50&startAt=0:

...
"values":
[
        {
            "id":
            {
                "name": "Software Simplified Workflow for Project TEST",
                "entityId": "e861280a-d24a-4cd8-b7e9-99d65e311e3b"
            },
            "description": "Generated by JIRA Software version 1001.0.0-SNAPSHOT. This workflow is managed internally by Jira Software. Do not manually modify this workflow.",
            "transitions":
            [
                {
                    "id": "1",
                    "name": "Create",
                    "description": "",
                    "from":
                    [],
                    "to": "10000", // Take note of this ID
                    "type": "initial"
                },
                ...
            ]
            "statuses":
            [
                {
                    "id": "10000", // This means that after Create transition, the status will be 'Backlog`
                    "name": "Backlog"
                },
                {
                    "id": "10001",
                    "name": "Selected for Development"
                },
                {
                    "id": "10002",
                    "name": "Done"
                },
                {
                    "id": "3",
                    "name": "In Progress"
                }
            ],
            "projects":
            [
               ...
            ]

Let us know if this could help with your use case.

Cheers,
Ian

HI @iragudo,

Thank you for your response.

If I want to retrieve just workflow for a specific project, how can I do that?
Or how to retrieve transactions for a specific project?

Thank you
Jan

You’re welcome, @janambroz.

In order to get the workflow for a specific project given a projectId, you can use Get workflow scheme project associations first; this will yield to something like:

{
    "values":
    [
        {
            "projectIds":
            [
                "10002"
            ],
            "workflowScheme":
            {
                "id": 10003,
                "name": "Jira Service Management IT Support Workflow Scheme generated for Project IT",
                "description": "This Jira Service Management IT Support Workflow Scheme was generated for Project IT",
                "defaultWorkflow": "jira",
                "issueTypeMappings":
                {
                    "10011": "IT: Post-Incident Review workflow for Jira Service Management",
                    "10010": "IT: Incident Management workflow for Jira Service Management",
                    "10013": "IT: Service Request Fulfilment with Approvals workflow for Jira Service Management",
                    "10002": "IT: Jira Service Management default workflow",
                    "10012": "IT: Service Request Fulfilment workflow for Jira Service Management",
                    "10015": "IT: Problem Management workflow for Jira Service Management",
                    "10014": "IT: Change Management workflow for Jira Service Management",
                    "10003": "IT: Jira Service Management default workflow"
                },
                "self": "https://iragudo.atlassian.net/rest/api/2/workflowscheme/10003"
            }
        }
    ]
}

Next, you use the issueTypeMappings - which maps a specific issue type to a workflow - as a parameter for Get workflows paginated REST API, for example

GET /rest/api/2/workflow/search?queryString=IT:%20Post-Incident%20Review%20workflow%20for%20Jira%20Service%20Management&expand=statuses,transitions

This will then give you the transitions and statuses for a specific project (for a particular issue type) aligned with your original post.

Cheers,
Ian