Jira API getting version details when you have the version name

Rees_ Ian
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.
May 6, 2024

I have an automation that has a Manual trigger - it is not triggered by a Version event.

In my automation, a user enters a version name as input when this rule is run manually and in the automation I want to check that the version exists

So I have the version name from the user input but how do I either get other details about the version such as the id OR just check whether the version exists

I am trying 

https://xxxxxxxx.net/rest/api/3/project/ITP/version?query=<user entered string>

and if the <user entered string> is a VALID version name, I get something like this in the response

body={self=https://xxxxxxxx.atlassian.net/rest/api/3/project/ITP/version?maxResults=50&startAt=0, maxResults=50, startAt=0, total=1, isLast=true, values=[{self=https://xxxxxxxx.atlassian.net/rest/api/3/version/35289, id=35289, name=abc, archived=false, released=false, projectId=12345}]}

But if the user enters an invalid string, the automation takes a long time to run then times out.

Is there a better way of doing this?

2 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
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.
May 6, 2024

Hi @Rees_ Ian 

You appear to be using this function, correct: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-project-projectidorkey-version-get

When I call that without a matching text to a version, it comes back immediately.

 

For which versions is the person searching?

Let's assume the version needed is unreleased, and they are trying to match on the name.  The REST API query could instead pull back all of the unreleased ones with status=unreleased and then use a match() with a dynamic regular expression (built from the manual trigger input) to find the correct one, if it exists.

Kind regards,
Bill

Rees_ Ian
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.
May 7, 2024

Thanks Bill,

I am basically trying to check for a mistype, where what the person has entered is not a version at all.  It doesn't matter whether the Version is Released or Unreleased.  Tbh it is quite a complex combination of automation and Automated Release Notes, that I have created to enable my internal users to test automation using a Clone on an existing version (including clones of its contents).

I've been doing some testing and I think with the above and I think I may be able to check {{webresponse.body.values.id}} is empty,null or 0 or something when an invalid version name is entered. Interesting that you get a return immediately - I will retest and see if maybe the delay I was seeing was a temporary system problem.  That insight is useful - thanks for your help

Like Bill Sheboy likes this
0 votes
Petru Simion _Simitech Ltd__
Atlassian Partner
November 3, 2024

We developed CIFJ - Versions Dashboard for Jira

https://marketplace.atlassian.com/apps/1235582/cifj-versions-dashboard?hosting=cloud&tab=overview

This might help you with your search.

Bill Sheboy
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.
November 3, 2024

Hi @Petru Simion _Simitech Ltd__ 

You have necro-posted similar content to recommend your marketplace product more than a dozen times today, which does not adhere to the community guidelines.   Some of your posts are to threads over a decade old.

Please carefully read these guidelines before posting further in the community.  Thank you.

Kind regards,
Bill

Petru Simion _Simitech Ltd__
Atlassian Partner
November 3, 2024

Thanks. I will read and comply.

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