Need assistance with REST API/curl

I have figured out everything I need with curl through REST API except how to 'Start Progress' on a main or sub-task ticket, and similarly how to 'Close' same. I can create and update and resolve and assign to tickets, but just can't seem to get one to 'Start Progress' nor 'Close'. Any help appreciated.

2 answers

1 accepted

Hi Jesse!

You need to use /issue/{issueIdOrKey}/transitions POST: https://docs.atlassian.com/jira/REST/latest/#d2e387 passing the id of transition:

{
    "transition": {
        "id": "5"
    }
}

Use /issue/{issueIdOrKey}/transitions GET to get possible transition and their ids: 

Can you give me some specific code for "Start Progress" specifically, and for "Close" ticket?

Hi Jesse!

Posting as new answer so I can use formatting.

1)  "Start Progress" and "Close" are transitions. Depending on current issue status and issue type (each issue type can be assigned to use specific workflow scheme), a specific issue can have different transitions.  That's why first thing we make REST call to rest/api/2/issue/MWC-1/transitions where MWC-1 is issue key you want to start or close. MWC-1 was in "TO-DO" status (i.e. not started yet) so in response I get JSON with 3 transitions that are possible for "TO-DO" status:

{
  "expand":"transitions",
  "transitions":[
    {
      "id":"11",
      "name":"Start Progress",
      "to":{
        "self":"https://vkrupach.atlassian.net/rest/api/2/status/3",
        "description":"This issue is being actively worked on at the moment by the assignee.",
        "iconUrl":"https://vkrupach.atlassian.net/images/icons/statuses/inprogress.png",
        "name":"In Progress",
        "id":"3",
        "statusCategory":{
          "self":"https://vkrupach.atlassian.net/rest/api/2/statuscategory/4",
          "id":4,
          "key":"indeterminate",
          "colorName":"yellow",
          "name":"In Progress"
        }
      }
    },
    {
      "id":"21",
      "name":"Done",
      "to":{
        "self":"https://vkrupach.atlassian.net/rest/api/2/status/10000",
        "description":"",
        "iconUrl":"https://vkrupach.atlassian.net/images/icons/statuses/closed.png",
        "name":"Done",
        "id":"10000",
        "statusCategory":{
          "self":"https://vkrupach.atlassian.net/rest/api/2/statuscategory/3",
          "id":3,
          "key":"done",
          "colorName":"green",
          "name":"Done"
        }
      }
    },
    {
      "id":"131",
      "name":"Start Review",
      "to":{
        "self":"https://vkrupach.atlassian.net/rest/api/2/status/10001",
        "description":"",
        "iconUrl":"https://vkrupach.atlassian.net/images/icons/statuses/information.png",
        "name":"In Review",
        "id":"10001",
        "statusCategory":{
          "self":"https://vkrupach.atlassian.net/rest/api/2/statuscategory/1",
          "id":1,
          "key":"undefined",
          "colorName":"medium-gray",
          "name":"No Category"
        }
      }
    }
  ]
}

2) Let's assume that we want to Start the MWC-1. From the previous JSON we see that id for Start Progress transitions is 11 so we make POST call to rest/api/2/issue/MWC-1/transitions passing the JSON in the body:

{
    "transition": {
        "id": "11"
    }
}

The same way your close an issue: When the issue is in status that has transition to Close, you make the REST to get the id of the Close transition, then you make the POST passing the id.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

763 views 2 19
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you