cancel
Showing results for 
Search instead for 
Did you mean: 

Start a new Instance via REST using process-instances

jaco1
Confirmed Champ
Confirmed Champ

Hi all. I am new to the forum. I have a question about the json structure when starting a new instance of an process using the REST API.

It states you send in the instance variables using a name / value pair. But you are not able to change the name parameter. Lets say you have 3 parameters then the json will look like this .

{

   "processDefinitionId":"LoanProcess:1:35",

   "businessKey":"LoanProcess",

   "variables": [

      {

        "name":"income",

        "value": 50000,

        "name":"loanAmount",

        "value": 20000 ,

        "name":"limitAmount",

        "value": 5000

 

      }

   ]

}

This does not comply with the json rules. IT should look like this.

{

   "processDefinitionId":"LoanProcess:1:35",

   "businessKey":"LoanProcess",

   "variables": [

      {

        "name1":"income",

        "value1": 50000,

        "name2":"loanAmount",

        "value2": 20000 ,

        "name3":"limitAmount",

        "value3": 5000

 

      }

   ]

}

But then you get a 500 response error that states it does not know the variable name "name1"

Am I doing something wrong ?

Kind Regards.

2 REPLIES 2

mdtabrezmca
Star Contributor
Star Contributor

Hello,

 i guess you have misunderstood it here variables is kind of HashMap which holds key="name" and value="value" so you are adding the key and value pairs to the HashMap with variables names and its vallues. important here is the name property should be unique else it will get overridden.

I hope this explaination is helpful to you.

Hi. thanks for the reply. So this method to add 3 variables is correct even if postman says the json format is not correct as the name and value tags are there 3 times.

{

   "processDefinitionId":"LoanProcess:1:35",

   "businessKey":"LoanProcess",

   "variables": [

      {

        "name":"income",

        "value": 50000,

        "name":"loanAmount",

        "value": 20000 ,

        "name":"limitAmount",

        "value": 5000

 

      }

   ]

}