Hello,
There is no possibility to add multiple members in a single REST API request. You need to send a separate Add member request for each new member. For example, in PowerShell, you can iterate through an array of distinguished names and add members one by one like so:
$memberIdentifiers = @(
"CN=John Smith,CN=Users,DC=example,DC=com",
"CN=Mary Sue,CN=Users,DC=example,DC=com",
"CN=John Doe,CN=Users,DC=example,DC=com"
) # TODO: modify me
$groupIdentifier = "CN=My Group,OU=Groups,DC=example,DC=com" # TODO: modify me
$baseUrl = "https://host.example.com/restApi"
$endpoint = "/api/directoryObjects/groupMembers"
# Request parameters
$requestUrl = $baseUrl + $endpoint
$requestHeaders = @{"Adm-Authorization" = "YOUR-SECURITY-TOKEN"}
# Make requests
foreach ($dn in $memberIdentifiers)
{
$requestBody = ConvertTo-Json @{
"group" = $groupIdentifier;
"newMember" = $dn
}
Invoke-RestMethod -Method POST -Headers $requestHeaders -Uri $requestUrl `
-Body $requestBody -ContentType "application/json"
}
Group members are added one by one everywhere in Adaxes, even if you add multiple members in bulk in Administration console. This is done because business rules that trigger Before/after adding a member to a group need to capture each operation separately and perform their actions for each new member.