Querying the User Groups to Which an IAM User Belongs
Function
This API can be used by the administrator to query the groups of a specified IAM user or used by an IAM user to query their own groups.
The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.
URI
GET /v3/users/{user_id}/groups
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
user_id |
Yes |
String |
IAM user ID. For details about how to obtain a user ID, see Obtaining Account, IAM User, Group, Project, Region, and Agency Information. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
Content-Type |
Yes |
String |
Fill application/json;charset=utf8 in this field. |
|
X-Auth-Token |
Yes |
String |
A token with Security Administrator permissions is required if the administrator is requesting to query the group of a specified IAM user. If an IAM user is requesting to query their own groups, the user token (no special permission requirements) of the user is required. |
Response Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
Array of objects |
User group information. |
|
|
Object |
Resource link information. |
|
Parameter |
Type |
Description |
|---|---|---|
|
description |
String |
User group description. |
|
id |
String |
User group ID. |
|
domain_id |
String |
ID of the account to which the user group belongs. |
|
name |
String |
User group name. |
|
Object |
User group resource link. |
|
|
create_time |
Long |
Time when the user group was created. |
Example Request
GET https://iam.myhuaweicloud.com/v3/users/{user_id}/groups
Example Response
Status code: 200
The request is successful.
{
"groups": [
{
"domain_id": "d78cbac186b744899480f25bd0...",
"create_time": 1578107542861,
"name": "IAMGroup",
"description": "",
"links": {
"next": null,
"previous": null,
"self": "https://iam.huaweicloud.com/v3/groups/07609e7eb200250a3f7dc003cb..."
},
"id": "07609e7eb200250a3f7dc003cb7..."
}
],
"links": {
"next": null,
"previous": null,
"self": "https://iam.huaweicloud.com/v3/users/076837351e80251c1f0fc003afe43.../groups"
}
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
The request is successful. |
|
400 |
Invalid parameters. |
|
401 |
Authentication failed. |
|
403 |
Access denied. |
|
404 |
The requested resource cannot be found. |
|
405 |
The method specified in the request is not allowed for the requested resource. |
|
413 |
A resource conflict occurs. |
|
500 |
Internal server error. |
|
503 |
Service unavailable. |
Error Codes
None
Last Article: Querying IAM User Details
Next Article: Querying the IAM Users in a Group
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.