获取给定组Activiti Rest API的用户 [英] Get users for a given group Activiti Rest API
问题描述
我正在寻找有关如何从给定activti-app组中检索用户的建议.阅读文档后,我试图通过发布包含用户任务过滤器ID数组的JSON正文来命中与用户及其组相关的终结点.
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.
在Postman中进行测试将返回500内部服务器错误"exception":不支持请求方法'POST'".显然,这是因为我应该发出GET请求,但是在这种情况下我无法附加JSON正文.
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.
上述示例端点:localhost:8080/activiti-app/api/enterprise/groups/{group_id}/users
Aforementioned example endpoint: localhost:8080/activiti-app/api/enterprise/groups/{group_id}/users
上述文档: https://docs.alfresco.com/activiti/docs/dev-guide/1.5.0/#_ user_and_group_lists
具体来说,此部分活动文档的屏幕截图
任何建议将不胜感激!
谢谢!
推荐答案
首先,我们必须确保我们在谈论的是组织组"而不是能力组".那是我最初的困惑.一旦创建了正确的组,就可以成功使用REST API来获取组列表和组成员列表.
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
哪个返回:
{
"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}
]
}
如果要通过过滤器,请使用?filter = some-group-name"进行过滤.
If you want to pass a filter, do it with "?filter=some-group-name".
现在,要查看特定组的成员,请传入组ID(它是数字).因此,要查看test-org-group-1的成员,我将使用:
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
哪个返回:
{
"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"}
]
}
这篇关于获取给定组Activiti Rest API的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!