Associate Roles to a User Group

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

Before you begin

  • Session ID is obtained from the login API.
  • Ensure that the session ID is valid and has not expired.

Request Structure

Endpoint: /usergroup-updateRoles
Type: PUT
Sample URL: https://<IP/HostName/TenantName>:<GWPORT>/avxapi/usergroup-updateRoles?gwsource=web

To understand the elements of the sample URL, click here.

Headers:
Content-Type: application/json
Table 1. Input Parameters
Name Description
sessionId (or) Token

Header

(Mandatory) Use either Session Id or Token received after login.

Type: String

Example: "sessionId": "ce7f1a14-2bf9-4e4a-89a8-bc780a255813"

gwsource

Query

(Mandatory) Source from which the request is triggered. The values can be:
  • web
  • external

Type: String

Payload

String

(Mandatory) Input data for request body in application/json format. For payload details, see Payload section.

Payload

Name Description
userGroupName

String

(Mandatory) Name of the user-group for consideration.

Example: "UG1"

assignedRoles

Array

(Optional) An array of role names to assign.

Example: ["R1"]

unassignedRoles

Array

(Optional) An array of role names to unassign.

Example: "[ ]"

Note: Even if the assignedRoles and unassignedRoles contain invalid role names that cannot be processed, the API would still go-ahead to assign/unassign any role in the list that can be successfully processed.

Response Structure

  • Status Code: 200 OK
  • Message: Successfully updated usergroup - role association.
  • Headers:
    • Content-Type: application/json
Table 2. Response Parameters
Name Description
response Contains the response attributes for assign role to user group.
message Success message or failure description in case of error.
appStatusCode Application specific status code for the response. Will be non-null for failure response.
tags More info in case of failure response.

Status Codes

HTTP Code appStatusCode Response Message
200 OK null Successfully updated usergroup - role association.
400 Bad Request ACCT_USERGROUP_001 Mandatory field 'userGroupName' is missing or empty
400 Bad Request ACCT_USERGROUP_044 Assign/Unassign Role list cannot be empty
404 Not Found ACCT_USERGROUP_027 UserGroup not found.

Sample Request/Response

Use Case

role_1, role_2, and role_3 are existing in the application. role_1 and role_2 have to be assigned to the user group appviewx_usergroup and role_3 has to be unassigned.

Sample Request
https://<IP/HostName/TenantName>:<GWPORT>/avxapi/usergroup-updateRoles?gwsource=external
Request Payload
{
 "payload" : {
   "userGroupName": "admin usergroup", 
   "assignedRoles": ["R1"], 
   "unassignedRoles": []
 }
 }
Sample Response
{
    "response": "Successfully updated usergroup - role association. ",
    "message": "Successfully updated usergroup - role association. ",
    "appStatusCode": null,
    "tags": null,
    "headers": null
}

What's Next

Reference

Understanding the sample URL:
  • IP/HostName/TenantName: Replace with the actual IP address, hostname, or tenant name based on the specific configuration in AppViewX.
    • IP: A unique identifier assigned to each device connected to a computer network that uses the Internet Protocol for communication

      The IP address will be included in the endpoint URL for an on-prem deployment.

    • HostName: A human-readable label assigned to a device (host) on a network

      The hostname will be included in the endpoint URL for an on-prem deployment.

    • TenantName: An identifier label for a tenant given to indicate which tenant's data the API request will access/modify

      The tenant name will be included in the endpoint URL for a SaaS deployment.

  • GWPORT: AppViewX gateway port

    A gateway port refers to a network port through which data is sent and received to communicate with a gateway in an on-prem deployment.

    Example: 31443

  • avxapi: Path parameter value (static) that is part of the endpoint's URL
  • Endpoint: Endpoint of the API, for example: execute-hook
  • gwsource: Source or origin of a gateway, for example: external.