Queries the Resource Access Management (RAM) user groups to which a RAM user belongs.


This topic provides an example on how to query the RAM user groups to which the RAM user Alice belongs. The response shows that Alice belongs to the RAM user group named Dev-Team.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListGroupsForUser

The operation that you want to perform. Set the value to ListGroupsForUser.

UserName String Yes Alice

The username of the RAM user.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
RequestId String DA772B52-BF9F-54CA-AC77-AA7A2DA89D46

The ID of the request.

Groups Array of Group

The list of the RAM user groups.

GroupId String g-zYtroLrgbZR1****

The ID of the RAM user group.

GroupName String Dev-Team

The name of the RAM user group.

Comments String Development team

The description of the RAM user group.

JoinDate String 2015-01-23T12:33:18Z

The time when the RAM user joined the RAM user group.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK

            <Comments>Development team</Comments>

JSON format

HTTP/1.1 200 OK

  "RequestId" : "DA772B52-BF9F-54CA-AC77-AA7A2DA89D46",
  "Groups" : {
    "Group" : [ {
      "GroupName" : "Dev-Team",
      "Comments": "Development team",
      "JoinDate" : "2015-01-23T12:33:18Z",
      "GroupId" : "g-zYtroLrgbZR1****"
    } ]

Error codes

For a list of error codes, visit the API Error Center.