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

Groovy script error

import static
import static

// initialize a new builder and give a default URL
def http = new HTTPBuilder("")

return http.request(GET,TEXT) { req ->

response.success = { resp, htmlText ->
assert resp.status == 200
log.debug("My response handler got response: ${resp.statusLine}")
return htmlText.getText()
return null

// called only for a 404 (not found) status code:
response."404" = { resp ->
log.error ("Not found")
return null

IM getting variable[response]is not declared

1 answer

1 accepted

0 votes
Answer accepted

There is nothing wrong with the script. Did you try to run it?

Sometimes, the script editor will report static type checking errors because it's unable to confirm the script is okay or not. Because groovy doesn't require objects and variables to be strongly typed, these sorts of errors can sometimes appear. They are not always something that needs to be resolved.

In this case, the httpbuilder will have defined that variable. But your code editor can't guess that ahead of time.

Suggest an answer

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

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

147 views 0 3
Join discussion

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