Reading variables from a user task to invoke a REST API

Hi,

I have developed a simple BPMN file using modeller. This is my flow -

  1. User Task that receives JSON request as input during the start up of the process instance

  2. Check a condition based on one of the values from the JSON request

  3. If yes, call a REST API POST using the JSON request sent initially.

I am unable to read the JSON values in my service task for REST. I have tried various ways to do that. Somehow I am able to read the value during my condition check but not later in the task.

Attaching my BPMN file. Please let me know where am I wrong or what is the right way to achieve my case?

The calls I am using are as follows - 
  1. localhost:8080/engine-rest/deployment/create (attaching the BPMN file here)

  2. localhost:8080/engine-rest/process-definition/key/RestDemo1/start
    {“variables”:
    {
    “age” : {“value” : 30, “type”: “Integer”},
    “name” : {“value” : “qwer”, “type”: “String”},
    “sal”: {“value” : 45000, “type”: “Long”},
    “addr”:{“value” : “MI3”, “type”: “String”}
    },
    “withVariablesInReturn”: true
    }

  3. localhost:8080/engine-rest/task/{id}/complete
    (empty JSON body)

RestDemo1.bpmn (7.5 KB)

Hi @Hema25,

in the connector configuration of the service task Call REST, you try to get the process variable mypayload. Do you write this process variable in one of the process steps before?

Cheers
kristin