Return a subset of fields from REST app call to bdm

1
0
-1

Using v7.2.3

How can we return only certain fields from a business data REST app call? We have a business object with say 20 fields and we just want to populate a select widget on a form. So we only need the value key (persistentId) and a display key. No need to transmit all 20 fields.

We already know how to make the call to get all the fields via REST. This shown in the docs here http://documentation.bonitasoft.com/bdm-api-0 which shows how to call a custom query or call for a single record by attribute. What we need is a combination of the two, a custom query which we can set the return attribute. We need to filter the returned values in the custom query.

If this is not possible, is it possible some other way to get the list? Maybe as a call to a case/pool which returns a list?

This is a make or break item for us to get a subscription or switch back to Talend for API. Of course we like what we are seeing in our Bonita POC test so far!

Thanks everyone for the help.

3 answers

1
+1
-1
This one is the BEST answer!

what you do is create a Custom Query that says:

Select c.myColumnName from Customer c

or if you want two columns

Select c.myColumnName1, c.myColumnName2 from Customer c

the other options, order by, where etc. can be added as required.

You then call this as per calling a normal REST call.

regards
Sean

PS: If this reply answers your question, please mark a resolved.

Comments

Submitted by BrianPeal on Thu, 05/05/2016 - 13:22

Thanks Sean, that sounds exactly what we thought too but read somewhere we couldn"t pick the fields. Guess we should have tested first. Let me verify and get back.

Submitted by BrianPeal on Thu, 05/05/2016 - 14:06

We tested and received a 500 error from the server. Change the SQL back and it works again. Here is our SQL:

SELECT l.persistenceId, l.en
FROM LocationType l

and the error message:
http://localhost:8080/bonita/portal/resource/process/Create/1.0/API/bdm/...

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

The calling API url is
../API/bdm/businessData/com.myCompany.LocationType?p=0&c=10&q=luLocationType

Now that we thought more about. We also may need to have the ability to use SQL table joins and access to the user's roles/permissions in the SQL. This seems to be a key aspect for populating pages for widgets like tables, select, autocomplete, etc. Also from a security & performance point-of-view, why would we want to send an entire record to the mobile device when just 4 fields may be required?

Has anyone successfully done this in 7.x?

Submitted by Sean McP on Fri, 05/06/2016 - 07:00

I've added this as a bug report as I agree with you big potential data exposure issue.

You can find it here and weigh in if you like:

https://bonita.atlassian.net/browse/BBPMC-381

regards
Seán

1
0
-1

Wow, spent some time switching to Talend today for the API layer. Boy I sure miss the flow and ease of Bonita BPM. It feels like I am stuck figuring out the plumbing, instead of figuring out the application. Bonita BPM abstracted a lot of the plumbing. How much long until we can get that feature into Bonita :-)

Comments

Submitted by Sean McP on Sat, 05/07/2016 - 08:48

Interesting and good to know, I've not used Talend so haven't got a reference.

I will add this comment to the bug to see what Bonitasoft say...

I've also added an idea for future release if you want to give it a PLUS

http://community.bonitasoft.com/ideas/change-organization-bdm-and-enhance-jpql

regards

Submitted by Sean McP on Mon, 05/09/2016 - 15:00

have you tried this?

http://documentation.bonitasoft.com/how-access-and-display-business-data-custom-page-0

also have a look at my comment on the bug report here

regards

1
0
-1

Thanks Seán.

We will switch to Talend ESB for our API. We might stay with Bonita UI Designer as we tested it successfully with a Talend REST service. Though we are wondering if the overhead of two platforms is worth it or not. And if there is enough value to use Bonita BPM and Talend too.

Notifications