Direct Inward Dialing: +1 408 916 9393
This API helps in adding user accounts to an Active Directory group from your application.
Request URL (JSON) Format: http:// <hostname> : <port> /RestAPI/AddUsersToGroup
Request Parameters:
Parameters | Mandatory | Description |
AuthToken | Yes | Authentication token obtained using the Generate AuthToken API. |
domainName | Yes | Domain in which the user object has to be modified |
inputFormat | Yes | Details of the attributes of user accounts to be modified. This attribute should be a JSONArray string and should be in the format mentioned below. [>,<JSONObject>,<JSONObject>]; JSONObject - key/value pair of LDAP attributes and their corresponding values Sample code in java: JSONArray userDetails = new JSONArray(); JSONObject json = new JSONObject(); json.put("sAMAccountName", "John"); userDetails.put(json); json = new JSONObject(); json.put("sAMAccountName", "Damien");userDetails.put(json); |
PRODUCT_NAME | Yes | Product name/module name from which the request is being sent; will be needed for auditing. |
addGroup | No | List of all sAMAccountName of the groups. |
primaryGroup | No | sAMAccountName of the primary group. |
duration* | No | The time period after which users must be removed from groups. |
durationType* | No | Specify a custom date or specify the duration in terms of minutes, hours, or, 'n' number of days. |
*When the duration and durationType parameters are specified in an API call, a workflow request is automatically created to add user accounts to groups. However, only the help desk technicians configured as requesters can raise a workflow request in ADManager Plus. Thus, ensure that you have the appropriate permissions before using these parameters, or simply send an API call without specifying these parameters to perform this action.
Response:
The response will be a JSON array string which contains the list of JSONObjects. Each JSONObject in the list represents a user sent in the inputFormat attribute in the request. Each object will contain the following properties about the status.
Parameters | Description |
status | Status of the user modification operation: '1' on successful modification. '0' if there is an error. |
statusMessage | Contains the message about the issues or errors that occur while performing the specified action. |
SAM ACCOUNT NAME | sAMAccountName of the user added to the group. |
userPrincipalName | userPrincipalName of the user account added to the group. |
Sample requests & responses:
Request 1:
http://admanager:8080/RestAPI/AddUsersToGroup?PRODUCT_NAME=MODULE&AuthToken=75adb327-91a0-4384-98b6-6c42332f8263&domainName=admp.local&inputFormat=[{"sAMAccountName":"John"}, {"sAMAccountName":"Damien"}]&addGroup=[Account Operators, Administrators]&primaryGroup=Domain Users
Response:
[{"sAMAccountName":"John","objectSID":"S-1-5-21-2664452653-2810534411-3271467435-4097","userPrincipalName":"John@admp.local","statusMessage":"Successfully modified.","status":"1"}, {"statusMessage":"sAMAccountName: Damien - No such user matched. Verify the LDAP attribute in search query or could be a privilege issue.","status":"0"}]
Request 2:
http://admanager:8080/RestAPI/AddUsersToGroup?duration=1&durationType=days&PRODUCT_NAME=SDP AddOn Check&domainName=ADMpdev.com&inputFormat=[{"sAMAccountName":"ByronTest"}]&addGroup=["Sales Department"]&AuthToken=31777bb0-d4ab-4a94-9a0e-e36783e25f38
Response:
[{"sAMAccountName":"ByronTest","statusMessage":"Add operation successful. ","status":"1"}]
Technician-based add users to group limit
The total number of times that technicians can add users to a group, in a day using the AddUsersToGroup API depends on the total number of licensed help desk technicians (HDTs).
The maximum number of API calls that an HDT can make is 50/day, irrespective of the tasks that the HDT performs. If you have two HDT licenses, the total number of API calls that you can make is 100/day, that is 2*50.
As the per day API call limit is not task-specific, you can perform any operation but the total number of API calls should not exceed 100. That is, an HDTcan perform a variety of operations like user creation, OU creation, password reset, etc., but the number of API calls for all the tasks put together should not exceed 100.