If the LDAP group is created in the LDAP server, generally in order to add the LDAP group, you would need to sync the LDAP group from the Artifactory UI by clicking the “import” button.
If you would like to import the LDAP group using the REST API, you may follow the below steps to achieve the same.
1. Create a group in the LDAP server- “igroup1” and add users to it.
2. Check the status of the LDAP groups under the Synchronised LDAP groups section [click the search icon to get the list of LDAP groups]. Refer to the below screenshot.
3. In order to import the groups using REST API, create a .json file for the group. I have used group.json
group.json-
{ "name" : "igroup1", "autoJoin" : true, "realm" : "ldap", "realmAttributes" : "ldapGroupName=igroup1;groupsStrategy=STATIC;groupDn=cn=igroup1,ou=users,dc=example,dc=com", "adminPrivileges" : false, "policyManager" : false, "watchManager" : false, "reportsManager" : false }
4. Use the Create or Replace Group API to import the LDAP group. Here is a sample output -
curl -XPUT -u<adminuser>:<passowrd>
https://Artifactory.com/artifactory/api/security/groups/igroup1 -H "content-type: application/json" -T group.json
5. You would see that the group has been successfully imported to the Artifactory.