Forums

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

Working with Activity Stream in Script Runner?

Tomáš Vrabec
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.
September 20, 2023

Hi my friend, 

I am solving quite easy, but quite tricky business requirement. 

"If user XYZ does not do any activity for X minutes, fire an action".

As I dont have any rich filters available, have to work with default JQL, Script Runner or JMWE. 

Idea was to use the Activity Stream, but as far as I am googling, there is no direct access to this component. 

I ended with code like

def command = 'curl --user USERNAME:PASSWORD* "http://jira.instance.com/activity?streams=user+IS+SXVCRN7"' 
def proc = command.execute()
proc.waitFor()

return "Process exit code: ${proc.exitValue()}"
//println "Std Err: ${proc.err.text}"
//return "Std Out: ${proc.in.text}"

But no luck with getting CURL response, as https will fire me up with response 35 (SSL/TLS handshake) and http ending with 28 - timeout, probably disabled at all. 

We are under F5 SSO, so not much I do about that. 

Is there anyone familiar with reaching Activity Stream from Script Runner? 

Thanks

2 answers

0 votes
Radim Kabeláč September 20, 2023

Use this:

def username = "Uživatel"
def password = "JehoHEslo"

def auth = "${username}:${password}".bytes.encodeBase64()


def connection = new URL( "https://mojeinstance.cz/activity")
.openConnection() as HttpURLConnection


connection.setRequestProperty("Authorization", "Basic ${auth}")
connection.setRequestProperty( 'User-Agent', 'RadimEk' )

//return connection.responseCode + ": " + connection.inputStream.text
return connection.inputStream.text
0 votes
Tomáš Vrabec
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.
September 20, 2023

Actually this client is on Data Center, but I cannot see that option when asking question. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.20.11
TAGS
atlassian, mindful member, mindful member badge, atlassian community, community kudos, community giveaway, atlassian swag, community values, empathy and kindness, badge challenge, atlassian learning, community engagement, swag giveaway

Earn a Badge, Win a Prize 🎁

Earning the Mindful Member badge proves you know how to lead with kindness, plus it enters you into a giveaway for exclusive Atlassian swag. Take the quiz, grab the badge, and comment on our announcement article to spread the good vibes!

Start here
AUG Leaders

Atlassian Community Events