Jira automation web request json escape double quotes

Päivi Passila January 9, 2025

Hei All. 

I need to create a Jira filter using web request (POST). Filter needs to have double quotes, since it uses JQL search extensions. Here's a simple example of the problematic filter:

{
"description": "Filter created by jira automation",
"jql": "issue in linkedIssuesOfQuery("project=ACME", "is blocked by")",
"name": "temp-pp2"

}

When I escape the double quotes with backslashes, it removes those from the filter query and responses with bad request:



 

Response

400Bad Request
Headers (17

 

 

Payload

{ "errorMessages": [ "Unable to find JQL function 'linkedIssuesOfQuery(project=ACME, is blocked by)'." ], "errors": {}


and the request payload is this:

 

Request

POST
Headers (2)

 

 

Payload

{ "description": "Filter created by jira automation", "jql": "issue in linkedIssuesOfQuery(\"project=ACME\", \"is blocked by\")", "name": "temp-pp2" }


So how to pass double quotes correctly? I've also tried with \", \\", \\\"

2 answers

0 votes
Kelly Arrey
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.
January 14, 2025

Hi @Päivi Passila

What I was thinking was:

  1. Save the Extended Search query as an Extended Search filter, e.g.,
    2025-01-14_14h45_59.png
  2. Then, call that filter in the automation, something like:

    "jql": "filter = 'My Filter'"
Päivi Passila January 14, 2025

My filter requires the version name, and that version creation will trigger the automation. 

Kelly Arrey
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.
January 15, 2025

I was trying to help you get around your quote issue above. Sorry.

0 votes
Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2025

Hi,

First: Are you on DC, Cloud...

The error you are getting does not seem to be related to the quotes:

Unable to find JQL function 'linkedIssuesOfQuery(project=ACME, is blocked by)'."

The linkedIssuesOf function does not exist. I have done a similar POST to create a filter and it worked perfectly:

{
"description": "Test1",
"jql": "status in (\"In Progress\",\"Ready for Release\")",
"name": "Test1"
}

Try a simple JQL without the linkedIssuesOf  function.

Jeroen

 

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2025
Kelly Arrey
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.
January 9, 2025

linkedIssuesOfQuery() is a function from the JQL Search Extensions for Jira add-on.

Jeroen Poismans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2025

Hi Kelly,

I get that it is a function added by an app. As I remember that was also the case on Server / DC, but the error remains in his example.

So indeed, think we should ask @Päivi Passila , do you have that app?

Jeroen

Päivi Passila January 14, 2025

Hei

Thanks for the replies.
Yes, we have JQL search extensions and we are in a Jira Cloud.
The simpler jql filter creation will work, like project=acme and issuetype=bug.

But I've understood that even thought Jira native filters are not supporting functions like eg. linkedIssuesOfQuery(), I can create ones using rest api. Of course in jira filter they appear as a list of issues, like this: "(id in (101385,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25)) ...etc.."

And those needs then to be kept in sync in JQL search extensions.

And what comes to suggestion of using:

issue in linkedIssues(issueKey, linkType)

It wont work. I need issues linked with certain types of links in spesific issue. And this can be achieved only with jql extented search.

thanks, päivi

Kelly Arrey
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.
January 14, 2025

Hi @Päivi Passila Can you save the Extended JQL search as a filter and call that filter in the automation? That might be worth a try.

https://support.atlassian.com/jira-software-cloud/docs/jql-fields/#Filter

 

 

Päivi Passila January 14, 2025

>>Can you save the Extended JQL search as a filter
This is what I try to do with the automation. 
And That's where those double quotes are gone. 

 

~päivi

Päivi Passila January 14, 2025

Longer story of my intention is, that I would like to have an automation, that triggers, when the new version (release) is created for the project. 
Then automation would create a Related work entry into that specific release object with the link to the filter, where we need to have more complex list of issues than just the default ones with issues having that fixversion. 

~päivi

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events