问候社区!我正在尝试按照本指南https://api-explorer.alfresco.com/api-explorer/#!/groups/createGroup使用REST API在户外创建新的用户组。我正在使用Postman进行REST调用。到目前为止,我已经成功使用(/ people)(POST)方法创建了新用户,如下所示:
POST:http://localhost:8080/alfresco/s/api/people?alf_ticket=TICKET_<<my_alf_ticket>>
以及正文中的以下JSON:
{
"userId": "user",
"password": "pass",
"userName": "user",
"firstName": "user",
"lastName": "user",
"email": "user@user.com"
}
不幸的是,当我类似地尝试创建一个新的组,如下所示时
POST:http://localhost:8080/alfresco/s/api/groups?alf_ticket=TICKET<<my_alf_ticket>>
并在正文部分
{
"authorityType": "GROUP",
"shortName": "GROUP1",
"fullName": "GROUP_GROUP1",
"displayName": "GROUP_GROUP1"
}
我正面临以下error
任何帮助将不胜感激:)
答案 0 :(得分:1)
这是旧的api:
1)
POST http://localhost:8080/alfresco/s/api/rootgroups/{shortName}
创建组2)
POST http://localhost:8080/alfresco/s/api/groups/{shortName}/children/{fullAuthorityName}
将组或用户添加到组。
对于新api,您应该使用:
POST http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/groups
CURL
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic YWRtaW46YWRtaW4=' -d '{
"id": "TEST_GROUP_ID",
"displayName": "Group for tests"
}' 'https://api-explorer.alfresco.com/alfresco/api/-default-/public/alfresco/versions/1/groups'
响应
{
"entry": {
"isRoot": true,
"displayName": "Group for tests",
"id": "GROUP_TEST_GROUP_ID"
}
}