How to create JIRA Issue with default issue type.

1,133 views
Skip to first unread message

Dmitry Zagorovsky

unread,
Sep 29, 2014, 10:58:29 AM9/29/14
to atlassian-...@googlegroups.com
Hello,

It seems that JIRA rest api doesn't know anything about default issue type.

Creating issue via /rest/api/2/issue (https://docs.atlassian.com/jira/REST/6.3.6/#d2e3555) requires specifying issue type parameter. Is it make sense to make issue type parameter optional and use default issue type if it is not specified?

The only option for now to create issue without user-specified issue type is to pick up the first issue type for project (if it is not sub-task).

Is there any other options to get the default issue type?

Thanks,
Dmitry

Yves Berquin

unread,
Sep 29, 2014, 11:04:40 AM9/29/14
to atlassian-...@googlegroups.com
Hello Dmitry,

You have to use the create meta REST API, as explained here:

Yves

Travis Smith

unread,
Sep 29, 2014, 11:15:11 AM9/29/14
to atlassian-...@googlegroups.com
Dimtry, 

Yves is correct, discovering the meta data before creation is important. You might be required to provide additional required fields or other data that is only discoverable by querying the meta data. I would suggest testing with some non-standard field configurations as well. So you know you're covering things like extra required fields. 

Cheers,

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connec...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-Travis

Dmitry Zagorovsky

unread,
Sep 29, 2014, 11:17:00 AM9/29/14
to atlassian-...@googlegroups.com
Hello Yves, 
thanks for help, but even rest/api/2/issue/createmeta doesn't know anything about default JIRA issue type.

Dmitry

Andy Brook

unread,
Sep 29, 2014, 11:22:17 AM9/29/14
to atlassian-...@googlegroups.com
Hi Dmitry,
AFAIK, if you don't specify fieldX in the POST data, JIRA will adopt the applicable default value, thereby saving you the effort and to/fro of figuring out those defaults?

Best Regards,
Andy

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connec...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Andy Brook

Dmitry Zagorovsky

unread,
Sep 29, 2014, 11:35:01 AM9/29/14
to atlassian-...@googlegroups.com
Thanks Andy,
JIRA doesn't use the default issue type while it isn't specified and returns Http status: 400. Body{"errorMessages":[],"errors":{"issuetype":"issue type is required"}}]]

Here is the response from rest/api/2/issue/createmeta (JIRA 6.3) and it doesn't provide any information about default issue type:
{"expand": "projects", "projects": [
    {
        "id": "10200",
        "key": "EPT",
        "name": "Empty Project Test",
        "avatarUrls": {
        },
        "issuetypes": [
            {
                "id": "5",
                "description": "The sub-task of the issue",
                "name": "Sub-task",
                "subtask": true
            },
            {
                "id": "2",
                "description": "A new feature of the product, which has yet to be developed.",
                "name": "New Feature",
                "subtask": false
            },
            {
                "id": "3",
                "description": "A task that needs to be done.",
                "name": "Task",
                "subtask": false
            }
        ]
    },
    {
        "id": "10001",
        "key": "SP",
        "name": "Second Project",
        "avatarUrls": {
        },
        "issuetypes": [
            {
                "id": "5",
                "description": "The sub-task of the issue",
                "name": "Sub-task",
                "subtask": true
            },
            {
                "id": "2",
                "description": "A new feature of the product, which has yet to be developed.",
                "name": "New Feature",
                "subtask": false
            },
            {
                "id": "3",
                "description": "A task that needs to be done.",
                "name": "Task",
                "subtask": false
            }
        ]
    },
    {
        "id": "10000",
        "key": "TP",
        "name": "Test Project",
        "avatarUrls": {
        },
        "issuetypes": [
            {
                "id": "2",
                "description": "A new feature of the product, which has yet to be developed.",
                "name": "New Feature",
                "subtask": false
            },
            {
                "id": "5",
                "description": "The sub-task of the issue",
                "name": "Sub-task",
                "subtask": true
            },
            {
                "id": "3",
                "description": "A task that needs to be done.",
                "name": "Task",
                "subtask": false
            }
        ]
    },
    {
        "id": "10100",
        "key": "THP",
        "name": "Third Project",
        "avatarUrls": {
        },
        "issuetypes": [
            {
                "id": "2",
                "description": "A new feature of the product, which has yet to be developed.",
                "name": "New Feature",
                "subtask": false
            },
            {
                "id": "5",
                "description": "The sub-task of the issue",
                "name": "Sub-task",
                "subtask": true
            },
            {
                "id": "3",
                "description": "A task that needs to be done.",
                "name": "Task",
                "subtask": false
            }
        ]
    }
]}

Thanks,
Dmitry
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Andy Brook

Travis Smith

unread,
Sep 29, 2014, 11:49:16 AM9/29/14
to atlassian-...@googlegroups.com
Actually, thinking about this some more, the default issue type is part of the Issue Type Scheme. This isn't exposed in a public REST API anywhere, so I don't think you can get at it. 

I'd create a request at https://ecosystem.atlassian.net/browse/ACJIRA, so the JIRA ecosystem team can confirm. I don't believe the issue create API will accept an issue without a type, but even if it did there's no way to correlate the type with the meta data to make sure you're including the right data. I believe you're blocked here, but hopefully the JIRA team knows something I don't. 

Cheers,
-Travis

Dmitry Zagorovsky

unread,
Sep 30, 2014, 5:32:27 AM9/30/14
to atlassian-...@googlegroups.com
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Andy Brook

--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connect-dev+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-Travis
Reply all
Reply to author
Forward
0 new messages