400 400: {"errorMessages":["Error in the JQL Query: Expecting ')' before the end of the query."],"er

Abhijeet Arewar September 29, 2020

Below is my jql query -->

labels in (security, Security, security-automated, Security-automated, security-library, security-external, Security-Library, Security-Sast, security-sast, pentest, Pentest, external-customer, External-Customer, appsec, AppSec, Appsec, security-researcher, security-customer, psg-crypto) AND issuekey not in (1218809, 1207609, DRPVG-596, 1258291) AND project not in ("Delete Me") AND issuetype not in (Test, "Test Execution", "Test Folder", "Test Plan") AND (affectedVersion in releasedVersions() AND status != Closed OR affectedVersion in unreleasedVersions() AND Severity in ("1 - Severe", "2 - High") AND status != Closed) AND issuetype = Bug AND project = DRSMX AND component in (CMDB, "Smart IT", "Service Level Management (SLM)", ITSM, ITSM_RKM, SLM, SRM, Platform) AND labels in (Security-Library, security-library, library-automated) AND Severity in ("1 - Severe", "2 - High") AND labels not in (E-case) ORDER BY Severity ASC

It works on UI but when i do it from API it fails to retrieve. 

1 comment

Comment

Log in or Sign up to comment
Abhijeet Arewar September 29, 2020

@Warren Could you please help here?

Warren
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.
September 29, 2020

Hi @Abhijeet Arewar 

Firstly, your query could be simplified quite a bit - you have a section which states project not in and issuetype not in, but then further down you have project=DRSMX and issuetype=Bug which overrides the earlier statements. You also have 2 sets of labels= with duplicate values.

What would be useful is for you to show the actual API call that you're passing in - this error looks as though you have something wrong with the syntax, probably missing quotes. Let me see the code you're using to build the API call

Abhijeet Arewar September 30, 2020

@Warren Actaully i am using maven dependency where i am calling jiraClient.searchIssues(JQLquery) while passing JQLquery to this function then i am getting above error

Warren
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.
September 30, 2020

@Abhijeet Arewar 

My Jira instance doesn't have many of the fields or parameters that your system does, so I can't even vaguely get it working in my UI

If you're saying that the JQL works in your UI, then the best I can offer is to slowly build the JQL up and see where it goes wrong. So, start with 

labels in (security, Security, security-automated, Security-automated, security-library, security-external, Security-Library, Security-Sast, security-sast, pentest, Pentest, external-customer, External-Customer, appsec, AppSec, Appsec, security-researcher, security-customer, psg-crypto) 

If it doesn't work, you know there's something wrong with the first bit.

If that works, add AND issuekey not in (1218809, 1207609, DRPVG-596, 1258291) and try again.

Keep adding bits until something goes wrong.

Don't worry about whether what's being returned makes sense or not, it's just to build up the JQL and work out where the error is creeping in.

Like Abhijeet Arewar likes this
Abhijeet Arewar September 30, 2020

@Warren Good Idea! Let me try your way. Thanks in advance. Will keep you posted.

Abhijeet Arewar October 1, 2020

@Warren Your above trick worked for me you are genius man thanks a lot for your quick help.

Have one more doubt,

Que. I am getting summary as null.

why I am not able to get whole summary of my JIRA for ex. Summary --> [9.8] [CVE-2020-13692] [postgresql] [42.2.5.jre7]

my maximum JIRA summary are in square bracket and it seems like square bracket is reserved keyword?

How i can get exact summary in my result?

Warren
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.
October 1, 2020

Hi @Abhijeet Arewar 

That's strange, because I put your summary into one of my tickets and when I run an API call, the result is shown below

Screenshot_2.jpgI don't believe that square brackets are reserved or are a problem at all - are you getting other summaries coming through in full, but the one that has square brackets is null? What language are you using? Could your code be causing the issue?

Abhijeet Arewar October 1, 2020

@Warren I am using java and yes you are correct I am getting other summaries but except above scenario. I am also wondering how come it is happening.

I will try to debug it further mean while if you have any suggestion then please let me know will do it your way.

Warren
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.
October 1, 2020

Hi @Abhijeet Arewar 

For the ticket which is giving you the blank summary, if you put the following into your browser where you're logged in to Jira in another window, what do you get?

https://CoName.atlassian.net/rest/api/3/search?jql=key=ABC-123&fields=summary

where CoName is your company's name in the Jira URL and ABC-123 is the key of the ticket that shows a blank summary

Abhijeet Arewar October 1, 2020

@Warren 

JIRA.PNGhttps://abc.com/rest/api/latest/search?jql=key=ABC-123&fields=summary

this works for me

While debug i am getting the same response but while fetching in my code i am getting null.

Warren
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.
October 1, 2020

@Abhijeet Arewar 

Right, so that means that the API is correctly returning the summary.

I have no idea why your code isn't getting that summary, you'll need to try and step through the code to understand it.

Abhijeet Arewar October 2, 2020

@Warren Thanks for your help

TAGS
AUG Leaders

Atlassian Community Events