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

How to create an issue with the REST API and immediatly set the priority?

Christian Studer CST October 2, 2012

I love working with the Jira REST API, but i've hit upon a problem I can't understand: When trying to create a new issue (POST, Jira OnDemand), it won't accept the 'priority' field:

{
    "fields": {
        "project": {
            "key": "SAND"
        },
        "issuetype": {
            "name": "Task"
        },
        "priority": {
            "name": "Critical"
        },
        "summary": "Testissue",
        "description": "Which is supposed to be critical"
    }
}

The error message I get is Field 'priority' cannot be set. It is not on the appropriate screen, or unknown.

I have also tried to set the priority by id: "id": "2", which gives me the same error message.

If I leave out the 'priority' field, the issue gets created and I can set the priority by updating the issue directly (PUT):

{
    "fields": {
        "priority": {
            "name": "Critical"
        }
}

According to the Jira 5 REST API documentation, this should work in the initial POST to, insted of requiring two requests.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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.
October 2, 2012

Is the field available on 'Create' screen? Or is it only there on 'Edit' screen? Check by creating the issue on UI.

Christian Studer CST October 2, 2012

Ah, you're right. 'Priority' is indeed only visible on the 'Edit screen'.

I did not know that these screens have such an impact on the API, thank you for the heads-up.

Jobin Kuruvilla [Adaptavist]
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.
October 2, 2012

Just an added validation. REST allows only what you do via the UI ;)

Like david.couturier likes this
0 votes
Swaraj gochhayat January 29, 2013

I am facing problem while making a post request to create an Issue via rest api. Do you mind telling me the platform you are using to make the POST request to the APIs.

0 votes
TraollyX January 7, 2013

Are you using the JRJC library to make these JIRA REST API calls?

TAGS
AUG Leaders

Atlassian Community Events