I would like to be able to add a flag to an issue via the Jira API. I was unable to find any documentation regarding this issue. Does anyone know how this works?
I've figured out how to do this, I'm not sure on the version of the API. I made a POST
request to:
yourdomain /rest/greenhopper/1.0/xboard/issue/flag/flag.json
And in the body (replace JIRA-ISSUE with your issue key):
{"issueKeys":["JIRA-ISSUE"],"flag":true}
I hope this helps.
Here is the best answer I found. https://answers.atlassian.com/questions/38062844/answers/38062897
There is a field called Flagged. It is a checkbox type field. There is a single value by default, Impediment. The field is checked for null status. If the field is null, the issue is not flagged. If the field is not null, the issue is flagged.
You would use the REST API for this. Examples are here –
https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue.
You'll either need to know the field ID (customfield_10000) or you need to to script the discovery of the field by searching the metadata – https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-discovering-meta-data-for-creating-issues.
An example of setting a custom field while creating the issue over API –
curl -D- -u fred:fred -X POST --data {"fields":{"project":{"key": "TEST"}, "summary": "Always do right. This will gratify some people and astonish the REST.", "description": "Creating an issue while setting custom field values", "issuetype":{"name": "Bug"}, "customfield_10000": [{"value": "Impediment"}]}} -H "Content-Type: application/json" http://localhost:8090/rest/api/2/issue/
non-minified data Expand source
{
"fields": {
"project":
{
"key": "TEST"
},
"summary": "Always do right. This will gratify some people and astonish the REST.",
"description": "Creating an issue while setting custom field values",
"issuetype": {
"name": "Bug"
},
"customfield_10000": [ {"value": "Impediment" }]
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With