Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Changing Status Using create issue API

I am using the below payload. But its throwing error  "transitions": "Field 'transitions' cannot be set. It is not on the appropriate screen, or unknown." 

Could you please help resolve this ? 

POST Method

URL : rest/api/2/issue/

Payload : 

{
"fields": {
"project":
{
"key": "LRN"
},
"summary": "Sample TEst cases created using Jira API",
"description": "example of cucumber automated test - Scenario",
"issuetype": {
"name": "Test"
},
"priority" : { "name": "2-High"},
"customfield_24683": { "value": "Cucumber" },
"customfield_11040": { "value": "End to End Tests (E2E)"},
"customfield_26580" : { "value" : "ADFv2", "child" : { "value" : "API" } },
"customfield_10831" : { "value": "TestTeam"},
"transitions": [
{
"id": "11"

}
]
}
}

1 answer

0 votes

Hi @Rajalakshmi Hariharan 

Having answered as below, I re-read your question and it looks as though you're trying to create an issue and transition it in one go, which I'm not sure if you can do, create it then use another API call to transition it.

You haven't specified whether it's for cloud or server, my answer assumes cloud, although it shouldn't be that much different.

When I change a ticket's status, I use

{"update":{},"transition":{"id":"141"}}

Note the update which you don't have, I think that's important

and the actual API call that I use is

/rest/api/3/issue/ABC-123/transitions?expand=transitions.fields&transitionId=141

Of course, keep your transitionId number, for me 141 is to close a ticket

Hi Warren,

Thanks for the response. I tried with Update as you suggested, now its creating the issue, but the status is not set.

{
"fields": {
"project":
{
"key": "LRN"
},
"summary": "SAmple TEst cases created using Jira API",
"description": "example of cucumber automated test - Scenario",
"issuetype": {
"name": "Test"
},
"priority" : { "name": "2-High"},
"customfield_24683": { "value": "Cucumber" },
"customfield_11040": { "value": "End to End Tests (E2E)"},
"customfield_26580" : { "value" : "ADFv2", "child" : { "value" : "API" } },
"customfield_10831" : { "value": "Leo"}

},
"update":{},
"transitions":
{
"id": "11"

}
}

 

Using the Get call for transitions the below are the list of transitions I got :

{
"expand": "transitions",
"transitions": [
{
"id": "11",
"name": "Start Progress",
"to": {
"self": "https://jira.com/rest/api/2/status/3",
"description": "'ASSIGNED'. This issue is being worked on by the assignee.",
"iconUrl": "https://jira.com/images/icons/statuses/inprogress.png",
"name": "In Progress",
"id": "3",
"statusCategory": {
"self": "https://jira.com/rest/api/2/statuscategory/4",
"id": 4,
"key": "indeterminate",
"colorName": "yellow",
"name": "In Progress"
}
}
},
{
"id": "71",
"name": "Automate",
"to": {
"self": "https://jira.com/rest/api/2/status/12381",
"description": "",
"iconUrl": "https://jira.com/images/icons/statuses/generic.png",
"name": "Active",
"id": "12381",
"statusCategory": {
"self": "https://jira.com/rest/api/2/statuscategory/4",
"id": 4,
"key": "indeterminate",
"colorName": "yellow",
"name": "In Progress"
}
}
}
]
}

Warren Community Leader Mar 02, 2021

Hi @Rajalakshmi Hariharan 

I'm not clear whether you're doing this or not. You need to use 2 separate API calls - one to create the issue, and another to change the status.

I also notice that in your update JSON you're using transitions whereas it needs to be transition without the "s" at the end.

Hi Warren,

I tried both transition and transitions, for both it didnt work.  I was trying to use create API to create and update in the same payload. Is it not possible to use same payload for create and update? 

should it be separate API call? 

Warren Community Leader Mar 04, 2021

Hi @Rajalakshmi Hariharan 

Yes, I don't believe that it can be done in 1 step, you will need to run 2 separate API calls

Hi Warren, Thanks a lot. Its working with multiple API calls. Is there a way to do it in bulk ?

Warren Community Leader Mar 04, 2021

Hi @Rajalakshmi Hariharan 

You haven't said how you're running these API calls - via code or Postman or something else. 

The easiest way to perform this procedure in bulk is via code. You have a loop for the number of issues that you want to create and run the 2 calls for each issue.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you