Hi everyone,
I’m integrating with Jira Cloud and I need to create a User Story.
I would like to know what the correct value should be for the issuetype field in the payload.
For example, if I want to create a Task, I use:
But what should I use to create a User Story?
Or is there another required parameter/value for creating User Stories in Jira Cloud?
If possible, could you also confirm which API endpoint is recommended for creating a User Story (e.g. /rest/api/3/issue) and whether any additional fields are mandatory for this issue type?
Thanks in advance for your help!
Hi @ibtissem cherni ,
The end point you mention is correct (See docs).
By the way: Work Item Type and Issue Type are the same. Atlassian recently renamed it, but in the API it is still called Issue Type, while in the UI it is called Work Item Type
You just have to adjust your JSON body for the creation of a different Work Item Type (User Story).
You will need to first check what the Work Item Type ID is for 'User Story". You can do that by hitting this endpoint first: GET /rest/api/3/issuetype.
There you can check to see if you have an Issue Type with the name 'User Story' or 'Story'. If so, take note of its 'id'.
Next, adjust your JSON payload for creating the issue. In the below example, the 'id' of the issue type 'User Story' is 10011
{
"fields": {
"customfield_10000": "09/Jun/19",
"duedate": "2019-05-11",
"issuetype": {
"id": "10011"
},
"labels": [
"test-issue",
"create_story"
],
"priority": {
"id": "3"
},
"project": {
"id": "10001"
},
"summary": "Main order flow broken"
}
}
A best-practice is to use the ID (like 10011) rather than names (like "Story" or "User Story") for things like this (integrations, automation rules, even filters) -- as @Rik de Valk _Brainboss_ suggested (please accept his answer).
We recently had some widespread impact when a Jira Admin changed the name of a highly used Status value (something like "In Progress" to "In progress"). Fortunately I noticed and we changed it back, but it temporarily broke many things.
Unfortunately it's nearly impossible to do this everywhere in Jira. But since you're building a new integration, I recommend the least brittle approach.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ibtissem,
Typically, you would use the Story work type. Make sure that work type is in the Work Type Scheme used by the project that you are creating the work item in.
And yes, that API should work fine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In general you just have to use the name of the type you want to create. If you need to create a User Story, use "User Story". This type have to exist in your JIRA instance and be configured to be used in your project.
You can use this endpoint to find the issue type available for your project. If the type you are looking for is missing you need to update your project settings.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.