Note
We've packed up and moved from Confluence to Discourse to bring you a better, more interactive space. Out of courtesy we didn't migrate your user account so - you will have to signup again
The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe
Greetings,
I'm trying to get an issue based on an specific field by using the /rest/api/3/search call, but I get null all the time.
Basically the line is:
def localIssue = httpClient.get("/rest/api/3/search?jql=cf[11201]~"+replica.RITM?.number)
I also tried a simple /rest/api/3/issue call, just like the example in https://docs.idalko.com/exalate/display/ED/How+to+make+any+Jira+Cloud+REST+API+call+with+the+Jira+Cloud+HTTP+client , and also got null:
def localIssue = httpClient.get("/rest/api/3/issue/{issueKey}")
(I'm passing directly an existant issueKey in the line above, not using a variable)
I also tried using both calls directly in the browser and I could retrieve the issue/s data without a problem.
So, it seems that I can't get any data from exalate using the REST api.
I did check that I have "Project Role (atlassian-addons-project-access)" in the Browse Projects permission for the project I'm searching in, also the issues I'm searching are already exalated, so exalate can see them.
Anyone would know if I'm doing something wrong in the get calls that I wasn't aware of or something I'm not seen?
Kind regards,
Alvaro
Hi Alvaro,
There is a simple way for you to check if the data is retrieved:
You can add to the incoming script:
Could you provide what error is generated on the error stack trace?
Kind regards,
Ariel
Hi Ariel,
Using the provided script, the error is :
No signature of method: com.exalate.hubobject.jira.DebugHelper.error() is applicable for argument types: (scala.collection.convert.Wrappers$MapWrapper) values: [[self:https://blablabla.atlassian.net/rest/api/3/issue/66527, ...]] Possible solutions: error(java.lang.String), every(), grep(), iterator(), macro(groovy.lang.Closure), print(java.lang.Object)
So, I see the httpClient.get() is not giving an http response, but a scala mapwrapper.
Using instead:
debug.error(localIssue.toString())
returns the response in string format.
So I tried:
def getCall = "/rest/api/3/search?jql=cf[11201]~${replica.RITM?.number}"
debug.error(getCall)
and it gives correctly:
Sync rules error
/rest/api/3/search?jql=cf[11201]~RITM6397855
(just to test the RITM was being passed correctly to the get call)
using that call in a browser gives the correct data.
and finally with:
def getCall = "/rest/api/3/search?jql=cf[11201]~${replica.RITM?.number}"
def localIssue = httpClient.get(getCall)
debug.error(localIssue?.toString())
throws a
Sync rules error
com.exalate.api.exception.IssueTrackerException
Error Stack Trace
com.exalate.api.exception.script.IssueTrackerScriptException: com.exalate.api.exception.IssueTrackerException at com.exalate.error.services.ScriptExceptionCategoryService.$anonfun$categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions$1(ScriptExceptionCategoryService.scala:31) at com.exalate.error.services.ScriptExceptionCategoryService.$anonfun$categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions$1$adapted(ScriptExceptionCategoryService.scala:27) at scala.collection.immutable.Stream.foreach(Stream.scala:533) at com.exalate.error.services.ScriptExceptionCategoryService.categorizeProcessorAndIssueTrackerExceptionsIntoScriptExceptions(ScriptExceptionCategoryService.scala:27) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:57) at com.exalate.replication.services.processor.ChangeIssueProcessor.$anonfun$executeScriptRules$1(ChangeIssueProcessor.scala:136) at scala.util.Try$.apply(Try.scala:213) at com.exalate.replication.services.processor.ChangeIssueProcessor.executeScriptRules(ChangeIssueProcessor.scala:134) at com.exalate.replication.services.processor.ChangeIssueProcessor.$anonfun$changeIssue$7(ChangeIssueProcessor.scala:96) at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307) at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:56) at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:93) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85) at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:93) at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) Caused by: javax.script.ScriptException: javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:158) at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264) at com.exalate.processor.ExalateProcessor.execute(ExalateProcessor.java:98) at com.exalate.processor.ExalateProcessor.executeProcessor(ExalateProcessor.java:55) ... 19 more Caused by: javax.script.ScriptException: com.exalate.api.exception.IssueTrackerException at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:320) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:155) ... 22 more Caused by: com.exalate.api.exception.IssueTrackerException at com.exalate.hubobject.jira.DebugHelper.error(DebugHelper.scala:16) at com.exalate.hubobject.jira.DebugHelper.error(DebugHelper.scala:13) at com.exalate.api.hubobject.jira.IDebugHelper$error.call(Unknown Source) at Script154.run(Script154.groovy:163) at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:317) ... 23 more
Kind regards,
Alvaro