How to add a flag to jira issue via rest api - jira

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

As mentioned here, "Flagged" is a checkbox custom field that accepts a single value "Impediment".
You should be able to set it using the JIRA REST API just like any other custom field. Maybe the examples here will help.
You can also set custom field values using the JIRA Java API.

I'm struggling with this right now. It seems that the Flagged field is not a checkbox type field anymore, but multicheckbox. So the data format I need to send to Jira Cloud API to set the flag in my case look like this:
{update:
{customfield_10021:
[{set:
[{id:“10019”}]
}]
}
}
To remove the flag the data I sent to Jira look like this:
{update:
{customfield_10021:
[{set:
[]
}]
}
}
In the above customfield_10021 is Flagged field's key and 10019 is id that sets the flag. Both of them you need to figure out for your Jira Cloud instance for example by aquiring issue with set Flagged field and checking how it is set.
Just to make it clear, to add/remove a flag I use edit issue end point described here.
Also, to be able to add/remove flag the Flagged field has to be on the edit screen of the issue type that you want to modify and your user needs to have proper priviliges.

Related

Eventbrite API get full description

When using an eventbrite api end point e.g.
https://www.eventbriteapi.com/v3/events/11111/?token=xxx
I only get the summary description e.g.
"description": {
"text": "Short description",
"html": "Short description"
},
Is there a way to get the full description?
That is strange... I ran a call to the API and I received a full description.
*Note: The description was on multiple lines.
Can you share the event_id this is happening to?
*Also, Note: I am using iTerm, Python with the requests package, and pretty print package(pprint) to make my calls to the API. Could this be a settings issue with the tool you are using to make the calls?
This is mentioned about the retrieve event endpoint.
Note: If the Event being retrieved was created using the new version of Create, then you may notice that the Event’s description field is now being used to hold the event summary. To retrieve your event’s fully-rendered HTML description, you will need to make an additional API call to retrieve the Event's full HTML description.
So, to fetch an events description, use this endpoint:
https://www.eventbrite.com/platform/api#/reference/event/retrieve/retrieve-event-html-description
This is the endpoint, in case someone gets here after Jul 2020 https://www.eventbriteapi.com/v3/events/event_id/description/
I had the same issue and found this on the official documentation: Retrieve full HTML description.
The reason is that, as mentioned in Sheldon's answer (and here in docs):
To retrieve your event’s fully-rendered HTML description, you will need to make an additional API call to retrieve the Event's full HTML description.

Podio API - GET form

Looking for some help from an experienced Podio API navigator!
I'm trying to build a feature into our rails app where I can pull the details of a form from Podio, so that I can then automatically generate a form in our environemnt that can post to the app.
To do that I would need to get the category and labels of the fields..
However, when you GET a form from podio, this is all it gives you for the fields:
"fields": [
{
"field_id": foo,
"settings": null
},
{
"field_id": foo,
"settings": null
}
any thoughts on how I might use this information to get the information that I need? Can I somehow use the field_id to GET the field?
You can get the app and the fields within it by using GET request to,
/app/{app_id}/field/{field_or_external_id}

Update "favorite" field for a project in Asana API

There's no documentation for updating the favorite field.
Currently I'm trying the following method:
PUT https://app.asana.com/api/1.0/projects/{projectid}
Post data:
{
"data": {
"favorite": true
}
}
There's no error reported. The Asana API returns the project details as the response with the responseCode 200. But when I view the project in Asana the Favorite field has not been updated.
How do I use the API to modify this field?
Resolved this. The Asana app didn't reflect the changes right away. It took a few moments to show the project in the Favorite list.
If anyone else is looking into this undocumented feature please be aware when setting the favorite field to "1" or "0" (the representation in the the API) it returns the 400 responsecode. The value True or False must be processed and not in quotes.

How to get assignee of an issue via JIRA REST API?

I'm still new to using JIRA and currently I'm using curl to invoke jira rest commands. I would like to get the assignee of an issue via rest but I can't seem to find the way how to do it.
You have to query for particular issue like this:
http://hostname/rest/api/2/issue/ISSUEKEY
you will receive a JSON object with nested assignee object looking like this:
"assignee": {
"self": "http://hostname/rest/api/2/user?username=abcde",
"name": "abcde",
"emailAddress": "mail#abc.com",
"avatarUrls": {....}
}
Just look right here:
You have to request the whole issue information. To do that, you have to know the JIRA Issue you want to have the assignee of. You will find it in "fields" -> "assignee".

JIRA API create issue with custom fields

i want to create an issue in JIRA by using the REST API provided by JIRA.
i am able to create a simple issue,
using this :
http://localhost:8080/rest/api/latest/issue
and data as follows:
{"fields":{"project":{"key": "TES"},"summary":"user name not showing validation message","description":"Hi validation is missing from user name","issuetype": {"name": "Bug"},"reporter":{"name":"BruceWayne"} }}
this is running fine.
now i want to add 3 custom fields while creating an issue. The custom fields are Authorname,
AuthorTag,AuthorID. how can i do this in rest api. what should i add in my data.
My sample data is as follows:-
{"fields":{"project":{"key": "TES"},"summary":"my bugs 5","description":"Hi","issuetype": {"name": "Bug"},
"customfield_10000":"roach#yahoo.com",
"customfield_10100":{"value":"abc"},
"reporter":{"name":"amit"},
"components": [{
"add" : {"name" : "abc"}
}],"priority": {
"id": "1"
}
}}
i want to use the names specified for customfields rather than customfield_XXXXX .
One way i think of is to hit the API after creating a simple issue ( using another API hit to get meta data as follows)
http://localhost:8080/rest/api/latest/issue/tes-79?expand=editmeta
and then do json parsing and again issue a put command to update the fields in same issue
but i was looking for a way to do it in single API hit (while creating an issue)
It should be just like setting any other field, but you have to use the field name "customfield_NNNNN" instead
I know that it is very late to answer this question, but then might help others if not the OP at this time of writing.
If you're in doubt about the create, then you could do something like this - Try a GET on an issue that you would rather create manually with the new parameters as well and then based on the output of the same you could then decide to update it with the new parameters with the new name or the old-fashioned customfield_xxx field.
Try a GET like this on cURL
curl -D- -u fred:fred -X GET -H "Content-Type: application/json" https://jira.fred.com/rest/api/2/issue/FRD-88651
Then you could possibly do a POST like how you've done earlier:
http://localhost:8080/rest/api/latest/issue

Resources