REST API: Process Instantiation problem

Hi, I’m trying to instantiate a process via rest api
“/API/bpm/process/”+process_definition_id+“/instantiation”

and json:

{
‘description’: ‘test’,
‘supplierIds’: 6,
‘summary’: ‘test’
}

but I get this error:
Exception: HTTP STATUS: 400 {“exception”:“class org.bonitasoft.engine.bpm.contract.ContractViolationException”,“message”:“Error while validating expected inputs”,“explanations”:[“6 cannot be assigned to INTEGER”]}

someone can help me?
thanks
Claudio

You are trying to instantiate the process named “Procurement request” that is part of the Procurement example.

The contract of this process expect three inputs:

  • summary: a text
  • description: a text
  • supplierIds: an array of number (JSON) translate to a List

So your JSON is currently invalid. A valid equivalent would be:

{
‘description’: ‘test’,
‘supplierIds’: [6],
‘summary’: ‘test’
}

Actually the error message is misleading. Instead of “6 cannot be assigned to INTEGER” it should be “6 cannot be assigned to List of INTEGER”. I open a request to get that fixed.

Hello
I have seen similar error in my Processes before.
I stopped using integer and started using strings to store all values.
But i have seen that the variable of type double works better.
Usually I save all numeric data as double.
Try and see if double is allowed.
Also make sure the datatype in your contract is formatted correctly.

regards

If you can share the process .bos file (using Google Drive, Dropbox,…) I’d like to reproduce the issue.

Thanks

the bos file is https://github.com/Bonitasoft-Community/procurement-example

thx so much antoine!

You’re welcome.

Quick note: please use “comment” instead of posting a new answer. We try to use “answer” to only actually provide a full valid answer to the question asked.