Rules are not getting hit

Posted on

I have create a set of data models and rules. I am trying to send APIs request for testing and getting back only nulls in the fields i am trying to set.

setup screenshots are attached.

request api:
curl --location --request POST 'http://localhost:8080/kie-server/services/rest/server/containers/instances/loan-application_1.1.0' \
--header 'Authorization: Basic ZG1BZG1pbjpyZWRoYXRkbTEh' \
--header 'Content-Type: application/json' \
--data-raw '{
"lookup": "default-stateless-ksession",
"commands": [
{
"insert": {
"object": {
"com.redhat.demos.dm.loan.model.Applicant": {
"creditScore": 230,
"name": "Jim Whitehurst"
}
},
"out-identifier": "applicant"
}
},
{
"insert": {
"object": {
"com.redhat.demos.dm.loan.model.Loan": {
"amount": 2500,
"approved": false,
"duration": 24,
"interestRate": 1.5
}
},
"out-identifier": "loan"
}
},
{
"fire-all-rules": {}
}
]
}'

response api:
{
"type" : "SUCCESS",
"msg" : "Container loan-application_1.1.0 successfully called.",
"result" : {
"execution-results" : {
"results" : [ {
"value" : {"com.redhat.demos.dm.loan.model.Loan":{
"amount" : 2500,
"duration" : 24,
"interestRate" : 1.5,
"approved" : true,
"reason" : "Congratulation your loan is approved!"
}},
"key" : "loan"
}, {
"value" : {"com.redhat.demos.dm.loan.model.Applicant":{
"name" : "Jim Whitehurst",
"creditScore" : 230
}},
"key" : "applicant"
} ],
"facts" : [ {
"value" : {"org.drools.core.common.DefaultFactHandle":{
"external-form" : "0:2:1433454381:1433454381:2:DEFAULT:NON_TRAIT:com.redhat.demos.dm.loan.model.Loan"
}},
"key" : "loan"
}, {
"value" : {"org.drools.core.common.DefaultFactHandle":{
"external-form" : "0:1:2063239414:2063239414:1:DEFAULT:NON_TRAIT:com.redhat.demos.dm.loan.model.Applicant"
}},
"key" : "applicant"
} ]
}
}
}

Attachments

Responses