Querying the User Groups Which an IAM User Belongs to
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.
Debugging
You can debug this API in API Explorer.
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 |
If the administrator is requesting to query the groups which an IAM user belongs to, see Actions. 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 used to create the user group. |
name |
String |
User group name. |
Object |
User group resource link. |
|
create_time |
Long |
Time when the user group was created. |
Example Request
Request for querying the user groups which an IAM user belongs to
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.myhuaweicloud.com/v3/groups/07609e7eb200250a3f7dc003cb..." }, "id": "07609e7eb200250a3f7dc003cb7..." } ], "links": { "next": null, "previous": null, "self": "https://iam.myhuaweicloud.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
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot