Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

rest api getting all active user issues

Sipke van der Meulen August 19, 2020

 i'm looking in to a way of finding all projects where a user has issues assigned to him/her

i found this nice and easy query: 

search?jql=assignee=currentuser()&startAt=0&maxResults=100" 

which works, but also includes issues set to 'done' 

so i was trying to get this working, by filtering in the query, using:  

search?jql=assignee=currentuser()&status=1234 

 but i seem to be missing something, since the result from my get request keeps returning the same amount of issues. 

Does anyone know how to format this, and if it'ss even possible doing a get request?  tnx in advance.  

 

2 answers

1 vote
Mehmet A _Bloompeak_
Atlassian Partner
August 19, 2020

Hi @Sipke van der Meulen ,

You should url encode the jql part as below.

assignee=currentuser() AND status=1234

Above encoded to below using https://meyerweb.com/eric/tools/dencoder/

assignee%3Dcurrentuser()%20AND%20status%3D1234

So the url will be

search?jql=assignee%3Dcurrentuser()%20AND%20status%3D1234
Sipke van der Meulen August 19, 2020

Thank you for your quick reply,  but maybe i explained this wrong: 

the first query i put there is working. I'm using a powershell script for this, so the full line would be something like: 

invoke-restmethod -uri "https://mycompany.atlassian.net/rest/api/3/search?jql=assignee=currentuser()&startAt=0&maxResults=100" -Headers $headers -Method GET

what i'm missing is the correct way to filter this based on a status: cause we work in a scrum based method, and i only want the active issues to return, meaning in the backlog, in todo, in blocked, but not in done. it's possible that i can't do it like this, and need to work around it, by adding a filter in jira, or using a post method instead of get (i prefer get, less permissions)  

I'm pretty new to jql, and atlassian products ( about 1 day of admin experience now) so i might be going the wrong way on this.  The result i'm trying to get is a list of projects where a user has issues asssigned to him/her. I then want those user to be added to  specific azure ad groups, based on the projects they work on, which manage membership to project specific resources and tooling. 

Mehmet A _Bloompeak_
Atlassian Partner
August 19, 2020

I understand it now. Then the jql should be

assignee=currentuser() and status!=Done

 You can try the jql on your jira web ui with the following url.

https://mycompany.atlassian.net/issues/?jql=assignee%3Dcurrentuser() and status!%3DDone
0 votes
Sipke van der Meulen August 19, 2020

i typed a very nice thank you reply here, but it seems to be lost between some bits and bytes. 

In the end i had to use the javascript  format for the url, to have the second argument accepted by jql like this: 

$test = (invoke-restmethod -uri "https://mycompany.atlassian.net/rest/api/3/search?jql=assignee%3Dcurrentuser()%20AND%20status%20not%20in%20(Done%2COpgelost)" -Headers $headers -Method GET)

Hop[e this helps someone  in the future 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events