Create issue with status via REST API

maciej.wicher February 25, 2020

I'm trying to create an issue with Done status (please don't ask me why - this will be some kind of confirmation of other actions) using REST API. Is it possible to set the status at the creation step? I know I can first create an issue and then moved it by `transition` but this is not quite efficient quick solution.

According to the docs I was trying something like this:

    curl --request POST \
    --url 'https://<company_name>.atlassian.net/rest/api/3/issue' \
    --user '<username:token>' \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json' \
    --data '{
    "fields": {
        "summary": "Remote with done status",
        "issuetype": {
        "id": "12113"
    },
    "project": {
        "key": "TEST"
    },
    "description": {
        "type": "doc",
        "version": 1,
       "content": [
        {
          "type": "paragraph",
          "content": [
        {
          "text": "Basic auth",
          "type": "text"
        }
      ]
    }
    ]
    },
    "transition": {
        "id": "761"
        }
   }
}'

 

But I'm getting an error:

errorMessages":[],"errors":{"transition":"Field 'transition' cannot be set. It is not on the appropriate screen, or unknown.

2 answers

1 accepted

3 votes
Answer accepted
JimmyVanAU
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 25, 2020

Hi Maciej,

You won't be able to create it with the Done status. Jira always creates the issue with the first status associated in the workflow.

To work around your issue, you'll need to create the issue, then send subsequent POSTs to transition the issue to Done.

The other alternative I've seen is to create a new issue type for the project, have a new workflow with only one status "Done", and then create this new issue type. Caveats here are reporting and dashboards will need to be updated. Please also don't forget to set a resolution!

Bhanu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2020

As JimmyVan said, subsequent posts is the option to go.

Another alternative: You can try adding a Post Function on Create transition; Fast Track Transition from script runner and trigger the transition to Done.

2 votes
adrian_hishow_external
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2024

Hello 

 

is this still the case? It must be one of the most requested features to be able to create a ticket with a certain status and not the first one that there is 

 

Thanks

Suggest an answer

Log in or Sign up to answer