Help Center/ Identity and Access Management/ API Reference/ API/ IAM User Management/ Modifying IAM User Information (By the Administrator)
Updated on 2024-11-18 GMT+08:00

Modifying IAM User Information (By the Administrator)

Function

This API is provided for the administrator to modify IAM user information.

The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.

Restrictions

This API cannot be used to change the mobile number and email address of an IAM user. To change the mobile number and email address, use the API described in Modifying IAM User Information (Recommended).

Debugging

You can debug this API in API Explorer.

URI

PATCH /v3/users/{user_id}

Table 1 URI parameters

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

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Fill application/json;charset=utf8 in this field.

X-Auth-Token

Yes

String

Access token issued to a user to bear its identity and permissions.

For details about the permissions required by the token, see Actions.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

user

Yes

Object

IAM user information.

Table 4 user

Parameter

Mandatory

Type

Description

domain_id

No

String

ID of the account used to create the IAM user.

name

No

String

New IAM username, which consists of 1 to 32 characters. It can contain letters (case-sensitive), digits, spaces, hyphens (-), underscores (_), and periods (.), and cannot start with a digit or space.

password

No

String

Password of the user. The password must meet the following requirements:

  • Can contain 8 to 32 characters. The default minimum password length is 8 characters.
  • Must contain at least two of the following character types: uppercase letters, lowercase letters, digits, and special characters.
  • Cannot contain the user's mobile phone number or email address.
  • Must meet the requirements of the password policy configured on the account settings page.
  • Must be different from the old password.

enabled

No

Boolean

Enabling status of the IAM user. true (default value) indicates that the user is enabled. false indicates that the user is disabled.

description

No

String

Description of the IAM user.

pwd_status

No

Boolean

Password status. true indicates that the password needs to be changed, and false indicates that the password is normal.

Response Parameters

Table 5 Parameters in the response body

Parameter

Type

Description

user

Object

IAM user information.

Table 6 user

Parameter

Type

Description

name

String

IAM username.

domain_id

String

ID of the account used to create the IAM user.

enabled

Boolean

Enabling status of the IAM user. true (default value) indicates that the user is enabled. false indicates that the user is disabled.

id

String

IAM user ID.

password_expires_at

String

Password expiration time. If this parameter is set to null, the password will never expire.

NOTE:

The value is a UTC time in the YYYY-MM-DDTHH:mm:ss.ssssss format, for example, 2023-06-28T08:56:33.710000.

description

String

Description of an IAM user. If there is no description, this parameter may not be returned.

pwd_status

Boolean

Password status. true indicates that the password needs to be changed, and false indicates that the password is normal. If no password is set, this parameter may not be returned.

last_project_id

String

ID of the project that the IAM user last accessed before logging out. If the user has not accessed any project, this parameter may not be returned.

links

Object

IAM user resource link information.

Example Request

Request for an administrator to change the password of IAM user named IAMUser to IAMPassword@

PATCH https://iam.myhuaweicloud.com/v3/users/{user_id}
{
    "user": {
        "domain_id": "d78cbac186b744899480f25bd02...",
        "name": "IAMUser",
        "password": "IAMPassword@",
        "enabled": true,
        "pwd_status": false,
        "description": "IAMDescription"
    }
}

Example Response

Status code: 200

The request is successful.

{
    "user": {
        "pwd_status": false,
        "description": "IAMDescription",
        "name": "IAMUser",
        "enabled": true,
        "links": {
            "self": "https://iam.myhuaweicloud.com/v3/users/07609fb9358010e21f7bc003751c7..."
        },
        "id": "07609fb9358010e21f7bc003751c7...",
        "domain_id": "d78cbac186b744899480f25bd02..."
    }
}

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.

409

A resource conflict occurs.

413

The request entity is too large.

500

Internal server error.

503

Service unavailable.

Error Codes

For details, see Error Codes.