Associate User Groups to a User

This API is used to associate or disassociate one or more user groups to a user.

URL: /user-updateUsergroups

Type: PUT

Parameters

Param Type Name Description Field Type
Header sessionId** (or) Token** Use either Session Id or Token received after login. String
Query gwkey Tenant Key. Needed only in case of multi-tenant installations. String
Query gwsource** Source from which the request is triggered (for example, web, external). String
Payload assignUserGroups An array of user group names to assign. Array
Payload unAssignUserGroups An array of user group names to unassign. Array
Payload loginName** Login name of the user. String

** - Mandatory value

Note: Even if the assignUserGroups and unAssignUserGroups contain invalid user group names that cannot be processed, the API would still go-ahead to assign/un-assign any user group in the list that can be successfully processed.

Possible Response Message and Code

HTTP Code Description Response Message
400 Bad request Usergroup name cannot be null or empty.
200 OK Updating user group with a role(s) successful TBD – Change text, multiple cases.

Sample Request/Response

Use Case

"usergroup_1, usergroup_2, and usergroup_3 are existing in the application. usergroup_1 and usergroup_2 have to be assigned to the user with loginname user_1 and usergroup_3 has to be unassigned"

Request URL

https://appviewxapi.com/avxapi/user-updateUsergroups?gwkey=f000ca01&gwsource=external

Request Payload
 {
 "payload": {
 "loginName": "appviewx",
 "assignUserGroups": [
 "usergroup_1",
 "usergroup_2"
 ],
 "unassignUserGroups": [
 "usergroup_3"
 ]
 }
 } 
Response
 {
 "response": "Successfully modified user-user group association",
 "message": " Successfully modified user-user group association ",
 "appStatusCode": null,
 "tags": null,
 "headers": null
 }