It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JQL saved word and Error message

Hello,

i'm trying to use Jira's REST api to get an issue key using its name (summary).

My get request looks like this so far:

var getUrl = {

url : "https://" + process.env.JIRA_USERNAME + ":" + process.env.JIRA_PASSWORD + "@" + process.env.JIRA_BASE_URL + '/rest/api/2/search?jql=Summary~"\"'

+ testCaseID + '\""',

method: "GET"

};

The testCaseID is the changing summary variable , and some of the summaries contain saved JQL words, therefore I receive the following error:

""Error in the JQL Query: 'Access' is a reserved JQL word. You must surround it in quotation marks to use it in a query."

 

I tried to add quotation marks and save the testCaseID as a new variable

var testCase = '"'+TestCaseID+'"'

and add it where the testCaseID was, but then I receive following error:

["Error in the JQL Query: Expecting either 'OR' or 'AND' but got <testname>"

 

How can I solve this issue?

1 answer

0 votes
Warren Community Leader Dec 04, 2019

Hi @Tal_Erez 

You haven't specified which version of Jira you're using (cloud or server), although I don't think it should make any difference. You also haven't specified which programming language you're using - looks a bit like Java?

When I pass this query to the API using C#, it returns successfully

 string query = @"/rest/api/3/search?jql=project=DS and summary~""Access""";

In C#, using 2 sets of double quotes leaves the string in double quotes

Hello @Warren 

I solved the problem by adding another backslash to the url. "\\" + TestCaseID  + \\""

solved it eventually.

I use Javascript. Thanks for the help :)

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you