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
Community Members
Community Events
Community Groups

How to send HTTP post Request via Scriptrunner Post function to receive JSON response


Hi Everyone,

 We have done the integration from jira to pager duty.

When the ticket is created in jira, Automatically it should trigger the event in the pagerduty.

While adding the scripted post function during create transition getting below errors,

The variable [body] is undeclared, [variable response is undeclared] and No such property:messages for class: java.lang.object..

the following script as follows:

import groovy.json.JsonBuilder
import groovy.transform.BaseScript

if("ZIA OPS Escalation"){

def http = new HTTPBuilder("")
def summary = issue.summary
def issueDetails = "ZIA OPS Escalation " + issue.key
def body
def issueJson = http.request(Method.POST, ContentType.JSON) {
body [ "service_key": "77011ebbefad47dd987f045636e04390","event_type": "trigger", "description": "summary", "details": "issueDetails"]
response.success = { resp, json ->
log.debug("PagerDuty Trigger Successful = " + json.messages)
response.failure = { resp, json ->
log.debug("PagerDuty Trigger Failed = " + json.messages)

1 answer

@srikanth kocherlakota , I have the same problem when tetiing HTTP b uilder in script console, it says body, response, header are undeclared .

Did you find the problem?


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

Improving the Create Issue Experience in Jira Service Management Cloud

Hello everyone!  We are very excited to announce some much needed changes to the issue create experience in JSM (the blue "create" button) at the top of the screen.  We have just starte...

271 views 14 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you