Hi,
In a process, I’ve created a business variable prestation on the pool that references a business data model like this :
- montantAvance
- modePerception
- field C that references another BDM
I’ve created a contract on the tab Contract : prestationContract that use the business variable
Can you tell how to create a case in order to match the contract ?
In the documentation, I’ve only found :
http://localhost:8080/bonita/API/bpm/case
{
“processDefinitionId”:“6489570222905471106”,
“variables”:[
{
“name”:“stringVariable”,
“value”:“aValue”
},
{
“name”:“dateVariable”,
“value”:349246800000
},
{
“name”:“numericVariable”,
“value”:5
}
I suppose I have to modify the payload request with something like this :
{
“processDefinitionId”:“6489570222905471106”,
“variables”:[
{
“prestationContract”: [
{
“name”: “montantAvance”,
“value”:“150”
},
{
“name”: “modePerception”,
“value”:“Virement”
}
]
}
]
}
but i have an error :
exception: “class org.bonitasoft.engine.exception.RetrieveException”
message: “USERNAME=walter.bates | org.bonitasoft.engine.core.process.instance.api.exceptions.SContractViolationException: Error while validating expected inputs: [Expected input [prestationContract] is missing]”
Thanks for your answer I’ve tried with the two following examples :
{
“processDefinitionId”:“6750167624302711955”,
“variables”:[
{
“name”: “prestationContract”,
“value”: [
{
“name”: “montantAvance”,
“value”:“150”
},
{
“name”: “modePerception”,
“value”:“Virement”
}
]
}
]
}
{
“processDefinitionId”:“6750167624302711955”,
“variables”:[
{
“name”: “prestationContract”,
“value”: {
“montantAvance”:“150”,
“modePerception”:“Virement”
}
}
]
}
But i’ve a message :
exception: “class org.bonitasoft.web.toolkit.client.common.exception.api.APIException”
message: “Data definition prestationContract doesn’t exists for process 6750167624302711955”
stacktrace: "[org.bonitasoft.web.rest.server.datastore.bpm.cases.CaseSarter.getDataDefinitionByName(CaseSarter.java:104),
I’ve seen that when we create case the portal, the following API is called :
http://localhost:8080/bonita/portal/resource/process/Traiter%20une%20demande%20d’avance%20de%20solde%201/1.0/API/bpm/process/4734828021282972817/instantiation
Can you tell why this is not the one that is mentionned in the Bonita Documentation…
but when I try with a payload request of type complex like indicated in my previous comments, I’ve still the problem.
Olivier, did you ever get this to work? I am stuck with the same problem.
Hi all,
I’ve been able with this:http://localhost:8080/bonita/API/bpm/process/{processId}/instantiation, and payload:
{“travelRequestInput” :
{
“userId”: 3,
“destination”: “CROQUET”,
“departureDate”: “2017-02-09”,
“numberOfNights”: 1,
“hotelNeeded”: true,
“reason”: “Prueba 17 Mayo 1”,
“status”: “pending”,
“refusalReason”: “”
}
}
The result is the caseId created:
{“caseId”: 7001}
Hope it helps,
Jose.
Hi, this didn’t have any solution, I think Bonita Doesn’t Support it?
Or I may use the “API Engine”.
I have the same problem, I’m starting a case with the apiURI = “/API/bpm/case/”;
Error that I get:
{“exception”:“class org.bonitasoft.web.toolkit.client.common.exception.api.APIException”,“message”:“Data definition notificacionRiesgoContract doesn’t exists for process 7400747355829459981”,“stacktrace”:"[org.boni
And this play load as string:
“{
“processDefinitionId”: 7400747355829460000,
“variables”: [
{
“name”: “notificacionRiesgoContract”,
“value”: {
“notificacionRiesgo”: {
“nombre”: “Nombre Prueba”,
“apellidos”: “Apellidos prueba”,
“dni”: “7871756C”,
“correo”: “htrj@**.com”,
“asunto”: “Asunto de prueba, detección de derrame de combustible en rampa de acceso a aviones”,
“descripcion”: “Descripción de prueba, detección de derrame de combustible en rampa de acceso a aviones, se comunica a las autoridades competentes.También se notifica a la empresa responsable para que inicie las acciones de prevención y mitigación necesarias para solventar el problema”,
“tipo”: “null”,
“seguridad”: “null”,
“problemadetectado”: “null”,
“estadoImplantacion”: “null”
}
}
}
]
}”
Hi,
I am having the same problem, to call the api to start a new process, the api returns me the error: Data definition travelRequest does not exists for process!
Could someone help me solve this problem?
follow my calling method.
public int startACase(long processDefinitionId) {
System.out.println("Starting a new case of process " + PROCESS_NAME + " (ID: " + processDefinitionId + “).”);
String apiURI = “/API/bpm/case/”;
String payloadAsString = “{ "processDefinitionId": 6952247650106423367,\n\t"variables": \n\t\t\t[{"name": "travelRequest" , \n "value" :{"destination": "Grenoble",\n\t\t\t\t "departureDate": "2017-02-09",\n\t\t\t\t "numberOfNights": 1,\n\t\t\t\t "hotelNeeded": true,\n\t\t\t\t "reason": "Bonita BPM 7.2 launch"}\n \t\t}]\n}”;
return consumeResponse(executePostRequest(apiURI, payloadAsString),true);
}
thank you
Hi.
Regarding the documentation example, a variable is declared like this :
{
“name”:“variableName”,
“value”:variableValue
}
In your example, for the variable prestationContract, you did this :
{
“prestationContract”: aList
}
It doesn’t match with the documentation.
I think your need to do this :
{
“name”: “prestationContract”,
“value”: [
{
“name”: “montantAvance”,
“value”:“150”
},
{
“name”: “modePerception”,
“value”:“Virement”
}
]
}
Or :
{
"name": "prestationContract",
"value": {
"montantAvance":"150",
"modePerception":"Virement"
}
}
I never tried to use this api with a complex object. Maybe this is not the solution.
Hi,
I have the same APIException" message: “Data definition travelRequestInput doesn’t exists”
I’m trying with Travel Requests Demo and putting the payload like this:
{ “processDefinitionId”: “6234868444427837933”,
“variables”: [
{“name”: “travelRequestInput” , “value” :
{
“userId”: 3,
“destination”: “Grenoble”,
“departureDate”: “2017-02-09”,
“numberOfNights”: 1,
“hotelNeeded”: true,
“reason”: “Bonita BPM 7.2 launch”,
“status”: “pending”,
“refusalReason”: “”
}
}
]
}
This works perfect, but I can’t mark it as a good response because I didn’t satrted the question.
Hi Hector,
Do my post on Wed, 05/18/2016 - 17:05 work for you?
Regards,
Jose.
Thanks josegante, it works perfect!!
You’re welcome. Can you then please mark my answer as correct?
This works perfect, but I can’t mark it as a good response because I didn’t satrted the question. I add a plus one (+1).
Ok, you’re right, thanks!