0

I'm using IBM BPM's Search API /rest/bpm/wle/v1/search/query for fetching tasks based on custom conditions. But this API is returning response only if the value is matching completely (case-sensitive). Is there any way to make it case-insensitive?

Sample API:

https://{host}:{port}/rest/bpm/wle/v1/search/query?secondSort=taskPriority&size=500&organization=byTask&sort=taskReceivedDate&filterByCurrentUser=false&columns=instanceName,taskActivityName,assignedToUser,instanceName,taskPriority,taskReceivedDate,assignedToRole,instanceId,instanceStatus&condition=assignedToUser|Equals|dave

The above API doesn't return the tasks which have 'assignedToUser' as 'Dave'

Pramod H G
  • 1,513
  • 14
  • 17

1 Answers1

1

A few issues / concerns with what you are using -

  1. This API is listed in the documentation as Deprecated, so you might want to look to moving to a different API.
  2. The call you are making will only work for an Admin user as the REST API won't let normal users see tasks they can't otherwise see unless they are an Admin. This is a security feature, otherwise any user could see the data about any task in the system.
  3. Usernames in IBM BPM are case insensitive (as far as I know) so I'm wondering if somehow what you really want is a "like" query and not "equals" (but you can't do that with the RestAPI). To that end I don't see how you could wind up with tasks assigned to "Dave" and "dave" since the user name is a single field in the underlying DB table, and the tasks are assigned to a user ID, not to their user name.

For the most part the issue is that "Search" is a misnomer and this feature is really "filter" (again, unless the user is an Admin).

In general it makes sense to have the "filterByCurrentUser" set to true and then the user will automatically be applying the rest of the search (filter) to their tasks.

It looks like the replacement API is something like

GET /rest/bpm/wle/v1/tasks[?savedSearch={string}][&fields={string}][&interaction={string}][&queryFilter={string}][&searchFilter={string}][&processAppName={string}][&sort={string}][&size={integer}][&offset={integer}][&filterByCurrentUser={boolean}][&calcStats={boolean}]

However when I attempt to duplicate your search there, it won't let me do "assignedToUser=" without picking an "interaction" value and the documentation says that when you pick one of those it behaves like "filterByCurrentUser" is set to true.

The good news is you can "filter" the results of the base query, and the "OWNER" and it looks to me that on my system (sometimes the underlying DB matters) executing -

rest/bpm/wle/v1/tasks?queryFilter=OWNER%3D'dseager'&size=100&filterByCurrentUser=false&calcStats=false

and

rest/bpm/wle/v1/tasks?queryFilter=OWNER%3D'DSeager'&size=100&filterByCurrentUser=false&calcStats=false

both returned the same results. I could not figure out how to configure a "like" query for this data when I was experimenting.

Note: As mentioned above, I'm an Admin on this server, so for a general user who isn't 'dseager' this should return 0 records.

If you want to make this available to non-Admin users, you will likely need to look at searching using the JavaScript API, as that is generally accessed only via a developer creating code, so if your solution requires that you ignore the security enforced by the REST API you can do so.

Drux
  • 486
  • 2
  • 6
  • Note - on my system I did see similar case sensitive behavior with the deprecated API call. – Drux Sep 08 '21 at 21:42