0 votes

Is it possible to add multiple members to a group in a singe call to the REST API? The example code only shows a single member. What would the data structure look like in that case?

by (60 points)

1 Answer

0 votes
by (3.2k points)


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.


Ok, thank you for that detailed explanation that explains why it works the way it does. Thanks.

Related questions

0 votes
1 answer

We have a 3rd party vendor that we are able to add users based on AD security groups. What I need to do is set a parameter for the number of available licenses and whenever ... the group is 495 I would like an email to trigger telling me to add more licenses.

asked Oct 12 by A_Pastor (70 points)
0 votes
1 answer

Hello, I have my OUs structured so each department we're working with has an OU for their service accounts under their department OU. e.g. OU=Service Accounts,OU=Sales,OU= ... add each new OU to the scheduled task but I was hoping for something more hands off.

asked Oct 19, 2015 by drew.tittle (810 points)
0 votes
1 answer

When configuring web page - under "Object Selection" - you can only choose 1 location (OU) when you select "Allow selecting only AD objects located under" - is there a way to have multiple OUs instead - perhaps using a LDAP filter?

asked Feb 2, 2021 by foleyjm (20 points)
0 votes
1 answer

Hi Using Adaxes 3.13.18001.0 on Server 2019 I'm adding a self service option for our domain users to be able to add people to groups they are set as the owner of but ... everywhere? I've checked the config page a number of times and can't see anything. Thanks

asked Jan 22, 2021 by chappers77 (1.4k points)
0 votes
1 answer

They can navigate to both the user or the group within the ADAXES web interface without issue. They can then either Add to Group or Add Member but the resulting ... something to the web interface which prevents changing the lookup domain. Any ideas? Thanks!

asked Apr 9, 2020 by VTPatsFan (610 points)
2,880 questions
2,600 answers
117,116 users