cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco REST API the "where" clause doesn't seem to work

4535992
Star Collaborator
Star Collaborator

The easiest thing in the world I want to retrieve the list of members of a site and filter them by role with the official rest api.

I'm using the alfresco community version 7.4.0 and postman with a basic authentication.

Here the get call whitout the where clause (is working):

https://www.mysite.com/alfresco/api/-default-/public/alfresco/versions/1/sites/mysite01/members

here the repsonse:

{
    "list": {
        "pagination": {
            "count": 6,
            "hasMoreItems": false,
            "totalItems": 6,
            "skipCount": 0,
            "maxItems": 100
        },
        "entries": [
            {
                "entry": {
                    "role": "SiteManager",
                    "person": {
                        "firstName": "test1",
                        "lastName": "",
                        "capabilities": {
                            "isGuest": false,
                            "isAdmin": false,
                            "isMutable": true
                        },
                        "displayName": "test1",
                        "emailNotificationsEnabled": true,
                        "company": {},
                        "id": "test1username",
                        "enabled": true,
                        "email": "test1@gmail.com"
                    },
                    "id": "test1username",
                    "isMemberOfGroup": false
                }
            },
            {
                "entry": {
                    "role": "SiteCollaborator",
                    "person": {
                        "firstName": "test2",
                        "lastName": "",
                        "capabilities": {
                            "isGuest": false,
                            "isAdmin": false,
                            "isMutable": true
                        },
                        "displayName": "test2",
                        "emailNotificationsEnabled": true,
                        "company": {},
                        "id": "test2username",
                        "enabled": true,
                        "email": "test2@gmail.com"
                    },
                    "id": "test2username",
                    "isMemberOfGroup": false
                }
            },
            {
                "entry": {
                    "role": "SiteConsumer",
                    "person": {
                        "aspectNames": [
                            ...
                        ],
                        "firstName": "test3",
                        "lastName": "",
                        "capabilities": {
                            "isGuest": false,
                            "isAdmin": true,
                            "isMutable": true
                        },
                        "displayName": "test3",
                        "emailNotificationsEnabled": true,
                        "company": {},
                        "id": "test3username",
                        "enabled": true,
                        "email": "test3@gmail.com",
                        "properties": {
                           ...
                        }
                    },
                    "id": "test3username",
                    "isMemberOfGroup": false
                }
            }
        ]
    }
... }

Here the get call whit the "where" clause, for filter the response only fot he manager, but it doen't filter (is  not working):

https://www.mysite.com/alfresco/api/-default-/public/alfresco/versions/1/sites/mysite01/members?where=(role='SiteManager')

but it doesn't filter....WHY ???? and it give me this error...

{
    "error": {
        "errorKey": "framework.exception.InvalidProperty",
        "statusCode": 400,
        "briefSummary": "06270120 La proprietà \"role\" con valore \"SiteManager\" non è valida per il confronto EQUALS",
        "stackTrace": "Per motivi di sicurezza l'analisi dello stack non viene più visualizzata, ma viene mantenuta la proprietà per le versioni precedenti",
        "descriptionURL": "https://api-explorer.alfresco.com"
    }
}

Am I using the "where" variable in the wrong way ? should I use the "fields" parameter instead ?

1 ACCEPTED ANSWER

The only parameter accepted for the WHERE clause is "isMemberOfGroup":

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

You can apply the same workaround described in the other thread. Use the Search API instead:

curl --location 'http://localhost:8080/alfresco/api/-default-/public/search/versions/1/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data '{
  "query": {
    "query": "PATH:\"/sys:system/sys:authorities/cm:GROUP_site_swsdp_SiteManager//*\""
  }
}'
Hyland Developer Evangelist

View answer in original post

3 REPLIES 3

4535992
Star Collaborator
Star Collaborator

Forgive me @angelborroy I generally don't ping people directly, but I would like to get answer on this question.

The only parameter accepted for the WHERE clause is "isMemberOfGroup":

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

You can apply the same workaround described in the other thread. Use the Search API instead:

curl --location 'http://localhost:8080/alfresco/api/-default-/public/search/versions/1/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data '{
  "query": {
    "query": "PATH:\"/sys:system/sys:authorities/cm:GROUP_site_swsdp_SiteManager//*\""
  }
}'
Hyland Developer Evangelist

thank you and sorry for the trouble