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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,630
Community Members
 
Community Events
185
Community Groups

How can this be done via the api?

This question is in reference to Atlassian Documentation: Flagging an Issue

I would like to be able to update the flag state on an issue via the api. How can this be done?

2 answers

2 votes
Steven Behnke
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.
Mar 30, 2016

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/
{
    "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" }]       
   }
}

This no longer appears to work.  I would post exactly what I'm seeing but this idiotic form won't let me enter json.

Like Matthew DeMartino likes this

I spent like 3 hours trying to figure it out and it always gave back "Field 'customfield_10021' cannot be set. It is not on the appropriate screen, or unknown.". To fix it, simply click on Settings Icon -> Issues -> Custom Fields. Search for "Flagged" click on "Screens", Add or remove associated screens" and just add it to all screens. Then it works perfectly.

Suggest an answer

Log in or Sign up to answer