Return value from HTTPResponse closure Grails HTTPBuilder to outer method -


i have code this

def lookuptickets() {     user currentuser = webauthservice.currentuser()     def http = new httpbuilder(zdurl)     http.auth.basic("${zduser}/token", zdapikey)     http.get(path: "/api/v2/users/search.json",               query: [query: currentuser.emailaddress],               requestcontenttype: contenttype.json, { resp, json ->               println "response status: ${resp.statusline}"                   def zendeskuserid = json?.users[0]?.id     })     return myresult } 

the line def zendeskuserid = json?.users[0]?.id gives me result looking return browser.

how can return value in outer method when in scope within inner closure?

do think not work?

def lookuptickets() {     def zendeskuserid      user currentuser = webauthservice.currentuser()     def http = new httpbuilder(zdurl)     http.auth.basic("${zduser}/token", zdapikey)     http.get(path: "/api/v2/users/search.json",               query: [query: currentuser.emailaddress],               requestcontenttype: contenttype.json, { resp, json ->                   println "response status: ${resp.statusline}"                  zendeskuserid = json?.users[0]?.id     })     return zendeskuserid } 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -