Alfresco REST API where clause reference

cancel
Showing results for 
Search instead for 
Did you mean: 
narkuss
Established Member II

Alfresco REST API where clause reference

Jump to solution

Hi all,

We are trying to set a logical OR in Alfresco REST API where clause, especifically on task endpoint from workflow REST API. We are not sure whether this is possible or not, and we are unable to find any referencea on these "where" clauses syntax.

Is what we are trying possible? Is there any reference documentation about these clauses in REST API?

Thanks a lot.

1 Solution

Accepted Solutions
narkuss
Established Member II

Re: Alfresco REST API where clause reference

Jump to solution

If anyone interested, here's the solution:

We were assigning tasks to a candidateGroup, not candidateUsers. So, when retrieving tasks through the /task endpoint, we had to set the "where" clause to "(candidateGroup=GROUP_XXX)". Without this clause, no results were returned.

The solution is to set the "where" clause to "(candidateUser=<username>)". Looking at the code, when this variable is set, it looks for all user's groups that are candidateGroup for existing tasks.

This clause is used in another REST API endpoints. This solution is useful for this specific use case, I'm not sure whether other "where" clauses from other endpoints will be able to handle an OR operator.

Hope this helps someone

View solution in original post

4 Replies
angelborroy
Alfresco Employee

Re: Alfresco REST API where clause reference

Jump to solution

From the source code:

https://github.com/Alfresco/alfresco-community-repo/blob/master/remote-api/src/main/java/org/alfresc...

I guess that "where" parameter is missed. So, likely, this option is not available from REST API.

Hyland Developer Evangelist
narkuss
Established Member II

Re: Alfresco REST API where clause reference

Jump to solution

Hi Angel,

We previously used the "where" clause, because we are trying to retrieve all tasks that are assigned to a candidate group, for a specific users of this group.

If we don't set this clause, no taks are returned, because, as stated in the API docs "Tasks are returned for which the authenticated user is the assignee or a candidate."

We reached this part of the code, and although I don't fully understand it, it seems that is not capable to handle OR operations. I will wait a bit to see whether someone faced the same problem.

For the record, we tried using OR keyword, using ldap-style operators (|(clause1)(clause2)), usgin java-like operators (| and || between clauses), and no one seems to be working...

Thanks again for your responses

 

narkuss
Established Member II

Re: Alfresco REST API where clause reference

Jump to solution

If anyone interested, here's the solution:

We were assigning tasks to a candidateGroup, not candidateUsers. So, when retrieving tasks through the /task endpoint, we had to set the "where" clause to "(candidateGroup=GROUP_XXX)". Without this clause, no results were returned.

The solution is to set the "where" clause to "(candidateUser=<username>)". Looking at the code, when this variable is set, it looks for all user's groups that are candidateGroup for existing tasks.

This clause is used in another REST API endpoints. This solution is useful for this specific use case, I'm not sure whether other "where" clauses from other endpoints will be able to handle an OR operator.

Hope this helps someone

EddieMay
Alfresco Employee

Re: Alfresco REST API where clause reference

Jump to solution

Hi @narkuss 

Thanks for providing your update. I've made this an accepted solution - since you've found an answer and this will hopefully help other users. 

Cheers,

Digital Community Manager, Alfresco Software.
Problem solved? Click Accept as Solution!