The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Get issue details as a json using groovy

Neha Sharma
Contributor
August 9, 2018

Hi all,

Is there a way to get the issue details in the form of a json from groovy. In other words, is it possible to achieve the functionality of the following api call -  https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-issue-issueIdOrKey-get using groovy script. ?

 

My requirement is to perform a regex search on an issue whenever the issue is updated. I want to find a particular string, like any string starting with http://abc-xyz.com/ (the string can be anywhere in the issue, be it body, comments, some custom field etc) and update the search results in a given CF. If anyone can point me to a solution or suggest how this can be achieved, it would be great. 

 

Thanks,

Neha 

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Aron Gombas _Midori_
Community Champion
August 10, 2018

There is a fully working Groovy snippet that gets an issue based on its key in the recipes of the PDF View Plugin: http://www.midori-global.com/products/jira-pdf-view-plugin/documentation/recipes#jira-rest-api

You can use it as is, or rework it to your needs. It is super short.

0 votes
Alexey Matveev
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 Champions.
August 9, 2018

Hello,

You can call this rest api from your Groovy Code. You can find more info how to execute rest calls in a groovy script here:

https://community.atlassian.com/t5/Answers-Developer-Questions/Calling-REST-service-from-groovy-script-Encoding-troubles/qaq-p/474914