Get users for a given group Activiti Rest API

随声附和 提交于 2019-12-13 06:38:15

问题


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!


回答1:


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"}
    ]
}


来源:https://stackoverflow.com/questions/39619148/get-users-for-a-given-group-activiti-rest-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!