Adam Kane Adam Kane - 2 months ago 23
JSON Question

Get users for a given group Activiti Rest API

I'm looking for some advice on how to approach retrieving the users from a given group of the activti-app. Having read the documentation I've attempted to hit the endpoint associated with users and their groups by a posting a JSON body containing an array of user task filter ids.

Testing this in Postman returns a 500 internal server error "exception": "Request method 'POST' not supported". Obviously this is because I should be making a GET request however I cannot attach a JSON body in that case.

Aforementioned example endpoint: localhost:8080/activiti-app/api/enterprise/groups/{group_id}/users

Aforementioned docs:
https://docs.alfresco.com/activiti/docs/dev-guide/1.5.0/#_user_and_group_lists

Specifically this section Screencap of activti docs

Any suggestions would be greatly appreciated!

Thanks!

Answer

First, we have to make sure we are talking about "organization groups" not "capabilities groups". That was my original confusion. Once I create the right kind of group I could successfully use the REST API to fetch both a list of groups and a list of group members.

As the docs point out, to get a list of groups, do this:

curl -uadmin@app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups

Which returns:

{
    "size":2,
    "total":2,
    "start":0,
    "data":[
       {"id":5,"name":"test-org-group-1","externalId":null,"status":"active","groups":null},
       {"id":6,"name":"test-org-group-2","externalId":null,"status":"active","groups":null}
    ]
}

If you want to pass a filter, do it with "?filter=some-group-name".

Now, to see the members of a specific group, pass in the group ID, which is a numeric. So to see the members of test-org-group-1 I would use:

curl -uadmin@app.activiti.com http://localhost:8080/activiti-app/api/enterprise/groups/5/users

Which returns:

{
    "size":2,
    "total":2,
    "start":0,
    "data": [
        {"id":2,"firstName":"Test","lastName":"User1","email":"tuser1@metaversant.com"},
        {"id":3,"firstName":"Test","lastName":"User2","email":"tuser2@metaversant.com"}
    ]
}