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".
Related
I am using the Microsoft Graph API to create Planner tasks, and I am wondering if there is a way to create a task including task details/description using a single HTTP request.
This old question from 2018 is asking about the same thing. The outcome in 2018 was that several separate requests were necessary ... first creating the task, then getting and updating its details object, which is a somewhat cumbersome process.
The original answerer has recently updated their answer to say that this behavior has changed and "you can set task details fields in the same request as creating the task". However, I'm confused as to whether this applies to the REST API itself, or to the Microsoft SDKs (which I am not currently using, as I don't need most of their functionality).
When I make a POST request to the /planner/tasks endpoint, and supply the details object in the body like such ...
{
"planId": "(... plan ID ...)",
"bucketId": "(... bucket ID ...)",
"title": "Title for new task",
"details": {
"description": "Some description for new task"
},
"assignments": {
(... assignment data ...)
}
}
... the task is created, but I don't see any description/notes. This applies both to the "v1.0" and "beta" APIs. (I tried the newer "notes" property on the beta API as well, with the same result.)
Based on the MS docs I could not find a conclusive answer either.
Should a request such as the one I listed work right now? If yes, in which API version? If no, what am I missing?
Thanks!
That request should work, but there is an issue with the returned response to the create operation not including the task details. If you read the task details after the creation (or reading task expanding the details), the description should be there.
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}
I want to get the total hours that every user has logged in, in a specific project every week.
In order to achieve this, I'm trying to get the whole worklog in the project, and then filter it by the worklog Author. This is the query I'm using:
https://jira.example.com/rest/api/2/search?startIndex=0&maxResults=100&jql=project=%27Test%20Project%27+and+worklogAuthor=testUser+and+updated%3E=-7d&fields=worklog
This brings back every issue that has been updated in the last 7 days, and the user is related to it. However, it also brings back the worklog of another user that has added time in the same issue for example.
My question is the following, is there a way to filter the query by name, and bring back the worklog of a particular user, without the worklogs of other users that are simply related to the same issue?
The query returns the results in a json format that look like this for every worklog of a user:
"worklogs": [
{
"author": {...}, // 8 items, where there's a 'name' field for the particular user
"updateAuthor": {...}, // 8 items
"comment": "",
"created": "2018-01-03T13:42:15.000+0200",
"updated": "2018-01-03T13:42:15.000+0200",
"started": "2018-01-03T13:42:00.000+0200",
"timeSpent": "1h",
"timeSpentSeconds": 3600,
"id": "10540",
"issueId": "10674"
},
Thanks
I don't think this is possible with jira out of the box. The jira rest api only supports retrieving work logs for issues, not users.
However, there are add-ons like Script Runner that provide additional JQL functions that allow you to query for issues where a specific user has logged work. You can easily execute such a JQL using the search REST API. This will give you a smaller list of issues/work logs to filter on.
Example JQL:
issueFunction in workLogged(on "2015/07/28" by admin)
More info about custom jql functions is available in the Script Runner documentation.
worklogAuthor = currentUser()
or
worklogAuthor = marc
might help you
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.
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