Updating JIRA ticket status using REST API
I can create a ticket in JIRA using CURL command and have nice json data.
curl -D- -u: -X POST --data @ <filename> -H "Content-Type: application / json" http: // <hostname>: <port> / rest / api / 2 / question /
Now I tried to update the status of the generated ticket but was getting the following error.
{"errorMessages":[],"errors":{"status":"Field 'status' cannot be set. It is not on the appropriate screen, or unknown."}}
Curl command:
curl -D- -u <user>: <pwd> -X PUT --data @ data_update.txt -H "Content-Type: application / json" HTTP: // <hostname>: 8100 / Others / API / 2 / question / MTF-3
source to share
Status is not a field in Jira and thus changing on the fly is not possible. JIRA API has no provision for this.
We must watch the transitions and change accordingly.
First execute http: // localhost: 8100 / rest / api / latest / issue / MTF -2 / transitions? expand = transitions.fields and know the IDs for the transitions.
For example: the transition ID for "Stop Progress" is 31, for "Done" it is 41.
Once known, use the following link, adding values ββspecific to your environment:
curl -D- -u <USER>:<PASS> -X POST --data '{"transition":{"id":"<TRANSITION_ID>"}}' -H "Content-Type: application/json" <JIRA_URL>:<JIRA_PORT>/rest/api/latest/issue/<JIRA_ISSUE>/transitions?expand=transitions.fields
Ref: Check Paul gives the answer - https://answers.atlassian.com/questions/107630/jira-how-to-change-issue-status-via-rest
source to share