Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Working with Activity Stream in Script Runner?

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

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

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
AUG Leaders

Atlassian Community Events