There are occasions in which we need to import Crowd groups into the Artifactory using the REST API. We can follow the Create/Replace Group REST API to perform the Crowd groups import. Below are the steps that need to be followed,
1. Created users in Crowd as "test1", "test2", "test3" and added to the "testgroup" in the crowd,
2. Connect Crowd with Artifactory and use the below Create group REST API with "realm" as "crowd",
Make sure the group name is the same on both the JSON passed as well as in the REST API call.
3. cURL command can be used to import the Crowd group and it should be as below,
$ cat group.json { "name": "testgroup", "autojoin": "false", "realm": "crowd" } $ curl -uadmin:password -XPUT http://localhost:8081/artifactory/api/security/groups/testgroup -H "Content-Type: application/json" -d @group.jsonThe "testgroup" will be imported successfully and once any user assigned to this "testuser" in the Crowd logs in will be automatically be assigned to the "testgroup".
No Crowd users ever logged in to Artifactory and the "testgroup" is empty,
When the user "test1" logs-in the Artifactory, the user "test1" is automatically assigned to the "testgroup" as it was assigned in the Crowd,