How to fetch all the issues comes under a single project by projectID?

sirsendu_gope June 17, 2020

Hi,

I am trying to fetch all the issues comes under a specific project by projectId. I search a lot but couldn't get any proper answer or what I got, that is not working.

 

I am hitting this api,

"/rest/api/2/search?jql=project={projectId}&maxResults=1000" 

and I am getting this error,

["Error in the JQL Query: Expecting operator before the end of the query. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'."]

 

 

Do anybody know the answer. That would be so helpful. 

Thanks

3 answers

0 votes
sirsendu_gope June 17, 2020

Though the above link is working from browser but it was not working while try to hit it from Java side with this command

HttpResponse response = getResponseFromUrl(parameters, new GenericUrl(url));

where parameters are the oauth parameters 

and Url is the Jira URl.

 

To get the proper response, need to pass the url like this way,

https://example-dev1.atlassian.net/rest/api/2/search?jql=project+in+(10002)&maxResults=1000
0 votes
Muhammad Ramzan_Atlassian Certified Master_
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.
June 17, 2020

Your query is right, but plz make sure what you are doing here {projectId} , if its paramaterized then make sure you passing the right project id value

sirsendu_gope June 17, 2020

This is the full URL
https://example-dev1.atlassian.net/rest/api/2/search?jql=project=10002&maxResults=1000

 

which I am calling. 

I am getting result for 

/rest/api/3/project/search?jql=&maxResults=200

this query but not for the above one. I am getting error for the above one.

sirsendu_gope June 17, 2020

The project id is good. I can fetch that particular project by that id.

0 votes
Frederik De Roover
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.
June 17, 2020

That should work.

ex:  https://jira.app.*.com/rest/api/2/search?jql=project=ID&maxResults=1000.

Perhaps you don't have the necessary rights to make the call?

sirsendu_gope June 17, 2020

I am getting response for other URL like,

/rest/api/3/project/search?jql=&maxResults=200

 

but not for this,

https://example-dev1.atlassian.net/rest/api/2/search?jql=project=10002&maxResults=1000

Suggest an answer

Log in or Sign up to answer