CamSDK filterService with expressions

Dear Community,
I currently build an HTML5 application with the camunda-bpm-sdk.js library. To get my tasks I like to use the filterService. This works well if my filter do not use any expresions like ‘${ currentUser() }’ or ‘${ currentUserGroups() }’.

Below the code

var myRestUrl = ‘http://sma0815:8081/engine-rest/

var camClient = new CamSDK.Client({
mock: false,
apiUri: myRestUrl
});

var filterService = new camClient.resource(‘filter’);

filterService.getTasks({id: ‘5a1b0325-87ea-11ec-986f-005056be7ec1’}, function (err, results) {
console.log(results);
});

referring to the documentation of the source code no parameter of the user id is foreseen.

I am wondering if it’s technical possible to use the camunda expressions by the Rest API.

Thanks a lot for the help

Michael

Hi @michael1,

In your example, you are only running an already created filter with the Id 5a1b0325-87ea-11ec-986f-005056be7ec1.

Expressions such as ${ currentUser() } can only work if authentication for the REST API is enabled as they get evaluated based on the authenticated user used in the API call.

https://docs.camunda.org/manual/7.15/reference/rest/overview/authentication/

Hi Hassan,
thanks a lot for your answer! Currently I’ve no rights to change the xml file on our server. I hope for this afternoon to get permission to do that. As soon I’ve activated the REST authentication, how will the user credentials transmitted to the engine?
Best regards

Michael

HI Hassan, Now I know how the credentials are transmitted. I’ve updated the web.xml in the engine-rest/WEB_INF/ folder according to your posted manual and it works perfectly now. I receive the ‘Windows Security’ prompt where I insert my camunda account and password. Thanks a lot for your help.

image

1 Like