Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to update filter jql via api from Jira Automation?

Richard A_ Michaels
Contributor
February 27, 2023

I have a Jira filter which uses the fix version field as a criteria.

Currently I manually update the fix version in the filter on a weekly basis.

The format of the fix version is standardized as vYYYYMMDD, I'd like to use automation to update the JQL in the filter on a weekly basis with the correct fix version via the API.

1 answer

0 votes
Trudy Claspill
Community Champion
February 27, 2023

Hello @Richard A_ Michaels 

Please share with us the rule you have constructed so far and let us know with which part specifically you need help.

Richard A_ Michaels
Contributor
February 28, 2023

HI Trudy, 

Thanks for the reply.  The automation is currently setup as a manual trigger with a single Send Web Request action.  The URL and custom data are below.  The call also has the authentication header.  The fixVersion value is hard coded for now until I can successfully update the filter with the API call.

URL

https://my-company.atlassian.net/rest/api/3/filter/22638

 

Custom Data

{

  "description": "VTrack Release Filter",

  "jql": "fixVersion=v20230206 ORDER BY key ASC",

"name": "Automation Test - Vtrack Release Tickets"

}

Trudy Claspill
Community Champion
February 28, 2023

So, is your question "how do I dynamically derive the fixVersion value based on the date the automation runs?" 

If that is your question, my next question is what is the relation between the date (or day of week or month) that the automation will run and the fixVersion value that would be used in the filter?

There are a variety of date and time functions that can be used with smart values in automation rules to derive and format date strings based on the current date/time or custom date/time fields.

Richard A_ Michaels
Contributor
February 28, 2023

Hi Trudy,
I'm getting a "bad request" error when I submit the call.

That's why I hard coded the fix version to ensure the API call can be successful with static data. That is not happenings.  I've did discover the jql was invalid but that wasn't what is causing it to be a bad request.

Here's updated custom data. I validated the jql by creating an actual filter with just the information below.

{
"description": "VTrack Release Filter",
"jql": "fixVersion = v20230227",
"name": "Automation Test - Vtrack Release Tickets"
}

Trudy Claspill
Community Champion
February 28, 2023

I've done some experimentation myself. I found that I got "bad request" when

- I provided a fixVersion value that did not actually exist in Jira

- If the JQL string included within it a value encapsulated in double quotes; i.e.

"jql": "fixVersion = "ver 20230227"",

The latter clearly doesn't apply to you, but does the former?

Richard A_ Michaels
Contributor
March 6, 2023

Hi Trudy,

This issue has been resolved.  It was a simple extra character in the header because of copy paste.

Like Trudy Claspill likes this
Abhishek Kalamkar July 28, 2023

@Richard A_ Michaels can you paste the one which is working in your case please. I am getting error while writing JQL query. @Trudy Claspill can you please help here to create the filter dynamically

Richard A_ Michaels
Contributor
July 31, 2023

@Abhishek Kalamkar This has already been resolved.

Thanks for the reply.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events