04-21-2019 07:56 AM
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.
04-22-2019 12:57 AM
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.
04-22-2019 05:27 AM
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
}
]
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.