When searching for issues with jql I get 400 Bad request error code

Tilen February 27, 2024

Until today I could make a request to 

https://api.atlassian.com/ex/jira/{cloudId}/rest/api/2/search

with jql in body and always get results. But now I always get 400 status code with message "Issue does not exist or you do not have permission to see it." I did not change anything in my integration, it just stopped working.  I get this error for every request I try to make.

My request body looks like:

{

"startAt":0,

"maxResults":1000,

"jql":"issue in ('mt-4517', 'demo-3', 'test-99', 'ts-2', 'test-310') and project in (projectsWhereUserHasPermission('Work on issues')) ORDER BY createdDate DESC",

"fields":["summary","project"]

}

 

I found out that the problem is in "issue in ('mt-4517', 'demo-3', 'test-99', 'ts-2', 'test-310') and" part of the JQL. If I create a request with JQL  with only "project in (projectsWhereUserHasPermission('Work on issues')) ORDER BY createdDate DESC" it returns correct results

2 answers

0 votes
David Bakkers
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.
February 28, 2024

Hello @Tilen 

Given that you're accessing Jira Cloud via https://api.atlassian.com/, then I assume you're using an OAuth 2.0 based connection, not Basic Auth.

That being the case, please note that CHANGE-1462 came into effect a few days ago, which was the application of CHANGE-1320 from December last year, whereby notice was given that requests to that endpoint that contain certain mistakes will no longer be accepted.

Double check your entire request URL to see if it contains any of the mistakes described in that deprecation notice as no longer being allowed.

0 votes
Tansu Akdeniz
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 27, 2024

Hi @Tilen 

When you search this query in Jira UI, does it return any issues?

Please also check Search for issues using JQL (POST)Authentication and authorization.

Tilen February 27, 2024

Hello,

yes it works in Jira UI. I pasted the wrong JQL before, the one that does not work via API request but it works in Jira UI is  

"issue in ('mt-4517', 'demo-3', 'test-99', 'ts-2', 'test-310') and project in (projectsWhereUserHasPermission('Work on issues')) ORDER BY createdDate DESC".

 

But all other request returns correct result like creating or updating worklogs, getting projects or issue statues and also if I create request with this JQL, the API returns correct result "project in ('DEMO', 'MK', 'MT', 'OT', 'TES', 'TEST', 'TS') and status in (10201, 10211, 6, 10001, 10217, 10212, 3, 10216, 10100, 1, 10210, 4, 5, 10202, 10000, 10215, 10222, 10213, 10209, 10208, 10214) ORDER BY createdDate DESC".  

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events