Tal
Tal

Reputation: 93

Error in the JQL Query: XXX is a reserved JQL word

I'm trying to use Jira's REST API in order to get an issue key using its name (summary). I do so using env variables and parameters that are received by the function (TestCaseID is the summary in this case). My get requests receive following information:

  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" };

But I get 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. 

this is because the TestCaseID contains this specific word (and unfortunately I can't change it). I don't understand why it asks me to surround it in quotes since this is exactly what I did when adding the "\" and \"". I tried multiple different approaches to fix it, but eventually, I receive the same error again and again. Does anybody have an idea how I can solve it?

Upvotes: 0

Views: 1843

Answers (1)

Tal
Tal

Reputation: 93

I managed to solve it in case someone will face same issue in the future: I used postman in order to use the feature that provides the request for Nodejs as explained here: Convert postman api call to Node.js call and saw that 2 backslashes are used instead of one. so adding a second one solved it for me :

`summary~"\\"${TestCaseID}\\""`

Upvotes: 2

Related Questions