How to pass value of business object attribut in the body of REST API

1
0
-1

Hello,

I am a beginner on Bonitasoft and I am looking to do a fairly simple exercise: make a POST call to a REST API by passing in the body of values ​​that I can retrieve from my business object (item) outstanding

So I use a REST connector and I would like to put a body like:
{
"id": "item.getId ()",
"actionCode": "item.getActionCode ()}",
"status": "item.getStatus ()"
}

How to do ?

Thank you

Comments

Submitted by mohamed.arrouch... on Fri, 01/24/2020 - 14:21

For information, i am using communauty version

Submitted by mohamed.arrouch... on Fri, 01/24/2020 - 14:43

Hello,

I think i found how to do.

I used a script to fullfill the body with this code and I think i works

import groovy.json.JsonOutput

Map json = new HashMap();
json.put("id", orderItemPassed.getId());
json.put("actionCode", orderItemPassed.getActionCode());
json.put("status", orderItemPassed.getStatus());
return JsonOutput.toJson(json)

Regards

No answers yet.
Notifications