Start a new Instance via REST using process-instances

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

Start a new Instance via REST using process-instances

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
Highlighted
Established Member II

Re: Start a new Instance via REST using process-instances

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.

Highlighted
Active Member II

Re: Start a new Instance via REST using process-instances

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

 

      }

   ]

}