REST Service POST error

0
Hi,  I am using Call REST (POST) to create a ticket in an external app. I'm getting a 400 Bad Request and not sure what the issue is. Can anyone point me in the right direction for how to debug this? My used serializedObjectToJson to get the below json and passed that to my call REST. {"fields": {     "summary": "this is the summary",     "issuetype": {"name": "Story"},     "project": {"key": "ESAT"},     "description": "describe it" }}   JSON debug log shows: tadmin    REQUEST    {"action":"executeaction","params":{"actionname":"ESAT.CreateJiraTicket"},"changes":{},"context":[],"profiledata":{"54e8ee9efeed1":95,"212afd146230400":192831}}    RESULT    {"actionResult":""}    (4121ms)    RESPONSECODE    200   And stacktrace: Error calling REST service     at ESAT.CreateJiraTicket (CallRest : 'Call REST (POST)') Advanced stacktrace:     at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:47) Caused by: 400: Bad Request     at ESAT.CreateJiraTicket (CallRest : 'Call REST (POST)') Advanced stacktrace:     at com.mendix.integration.actions.microflow.RestCallAction.checkStatusCode(RestCallAction.scala:68)     at com.mendix.integration.actions.microflow.RestCallAction.com$mendix$integration$actions$microflow$RestCallAction$$handleResponse(RestCallAction.scala:60)     at com.mendix.integration.actions.microflow.RestCallAction$$anonfun$execute$1$$anonfun$apply$1.apply(RestCallAction.scala:42)     at com.mendix.integration.actions.microflow.RestCallAction$$anonfun$execute$1$$anonfun$apply$1.apply(RestCallAction.scala:41)     at com.mendix.integration.util.InputStreamUtil$.using(InputStreamUtil.scala:36)     at com.mendix.integration.actions.microflow.RestCallAction$$anonfun$execute$1.apply(RestCallAction.scala:41)     at com.mendix.integration.actions.microflow.RestCallAction$$anonfun$execute$1.apply(RestCallAction.scala:40)     at com.mendix.integration.util.InputStreamUtil$.using(InputStreamUtil.scala:36)     at com.mendix.integration.actions.microflow.RestCallAction.execute(RestCallAction.scala:40)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)     at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)     at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)     at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172)     at com.mendix.core.component.InternalCore.execute(InternalCore.java:414)     at com.mendix.webui.actions.client.ExecuteAction.execute(ExecuteAction.java:144)     at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply$mcV$sp(ClientRequestHandler.scala:312)     at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:302)     at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:302)     at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2$$anon$1.execute(ActionDispatching.scala:143)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)     at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2.apply(ActionDispatching.scala:145)     at scala.util.Try$.apply(Try.scala:192)     at com.mendix.core.session.Worker$$anonfun$receive$3.applyOrElse(ActionDispatching.scala:139)     at akka.actor.Actor$class.aroundReceive(Actor.scala:465)     at com.mendix.core.session.Worker.aroundReceive(ActionDispatching.scala:135)     at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)     at akka.actor.ActorCell.invoke(ActorCell.scala:487)     at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)     at akka.dispatch.Mailbox.run(Mailbox.scala:220)     at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)     at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)     at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)     at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)     at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)  
asked
2 answers
2

Hi Tracy, based on Jira's spec, you should be able to get a message out of the 400 response with more detail. In their example, the 400 response comes with JSON describing the issue like this:

 

{
    "errorMessages": [
        "Field 'priority' is required"
    ],
    "errors": {}
}

 

You should be able to capture this information by adding custom error handling (custom with rollback) to the REST call step. In the error flow, you'll have a variable available called $latestHttpResponse (you have to enable this checkbox in the REST call activity settings). You could then log the value of $latestHttpResponse somewhere or use the debugger to capture its value. 

answered
0

Tracy,

One thing that I do see in your post is that the Json comes back with a 200 status code.  Have you taken a look at the service as it may be having a problem after you do the POST?

answered