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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,811
Community Members
 
Community Events
184
Community Groups

Sending pay load from Jira using Groovy script

Hi 

I want to send information of issues in JSON format as a payload(using POST method) so that I can store it in a data base(requirement) also I would like to access it and work on it in a Third party app. Is this possible? 

1 answer

0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jun 29, 2021

Yes that is possible.

You have to decide how/when to send this information. It could be triggered by a workflow transition/post function, based on a Scripted Listener or a Job that runs on a schedule.

Then once you've decided that and have one or more issue object, you have to decide what attribute of the issue (and custom fields) you want to construct your JSON with. E.g:

import groovy.json.JsonBuilder
import com.atlassian.jira.component.ComponentAccessor
def cfm = ComponentAccessor.customFieldManager
def custFieldObject = cfm.getCustomFieldObjectsByName('custom field name')[0]
//assumes issue is declared and available
def newObject = [:]
newObject.issueKey = issue.key
newObject.assigneeEmail = issue.assignee.emailAddress
newObject.customField1 = issue.getCustomFieldValue(customFieldObject)
def jsonString = new JsonBuilder(newObject).toString()

Then you need to figure out how you want to connect to your third party app and make sure you can authenticate etc.

Or maybe your third party app is flexible, in which case, you might be better off using a WebHook from the jira side to send a standard payload.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events