Send Message via Rest API Bonita 7.10.3 - Community

Hi, 

I need to send a message via rest api to a specific instance of a process. I create a CatchMessage called abortPayment with a correlation called processInstanceIdKey  (groovy with  "processInstanceId"). Via rest api I do the next request:

  • Header
    Content-Type : application/json
  • URL
    /http://localhost:8080/bonita/API/bpm/message
  • Method
    POST
  • Request Payload
     {
     "messageName" : "catchMessage123" ,
     "targetProcess": "EnviaMensagem",
     "messageContent" : {
             "abortPayment" : {
             "value" : "abortPayment"
             }
      },
      "correlations" : {
             "processInstanceIdKey" : {
                "value" : 8006,
                "type" : "java.lang.Long"
              }
      }
    }

It returns Status 204 Content, although nothing is change in instance. Can someone help me? Diagram

Thanks,

Diana

Hi,
The payload should be something more like this:

 {
     "messageName" : "abortPayment" ,
     "targetProcess": "EnviaMensagem",
     "messageContent" : {},
      "correlations" : {
             "processInstanceIdKey" : {
                "value" : 8006,
                "type" : "java.lang.Long"
              }
      }
    }

messageContent is additional data delivered with the message, in your use case you are not using message content (see message content property tab)

HTH
Romain

It works!!! Thank you so much!!!