Updated on 2024-12-30 GMT+08:00

Modifying a User

Function

This API is used to modify a user.

Constraints

null

URI

PUT /api/v2/tenant/users/{user_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

user_id

Yes

String

User ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Set this field to "application/json;charset=utf8".

Authorization

Yes

String

Authentication credential. The value is "Bearer {access_token}". access_token is obtained by calling the API for obtaining an access credential.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

user_name

No

String

Username, which is a unique identifier in an enterprise.

mobile

No

String

Mobile number, which is unique in an enterprise.

org_code

No

String

Organization code.

name

No

String

Real name.

email

No

String

Email address.

employee_id

No

String

Employee ID.

first_name

No

String

Name.

middle_name

No

String

Middle name.

last_name

No

String

Last name.

pwd_must_modify

No

Boolean

Whether the password must be changed upon the first login.

attr_gender

No

String

Gender.

attr_birthday

No

String

Date of birth. Format: yyyy-mm-dd.

attr_nick_name

No

String

Alias.

attr_identity_type

No

String

Certificate type.

attr_identity_number

No

String

Certificate number.

attr_area

No

String

Country or region code.

attr_city

No

String

City.

attr_manager_id

No

String

Immediate superior.

attr_user_type

No

String

Personnel type.

attr_hire_date

No

String

Onboarding date. Format: yyyy-MM-dd.

attr_work_place

No

String

Work location.

user_org_relation_list

No

UserOrgRelationListOption object

extension

No

Object

Custom extended attribute.

Table 4 UserOrgRelationListOption

Parameter

Mandatory

Type

Description

orgCode

Yes

String

Organization code.

relationType

Yes

String

Ownership. A user only belongs to one organization and can be mounted to a maximum of nine organizations.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

user_id

String

User ID.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error details.

Example Requests

Modify the username to zhangsan, mobile number to 12345678901, and email address to zhangsan@example.com.

PUT https://{domain_name}/api/v2/tenant/users/{user_id}

Authorization: Bearer 334963fc-1e4a-473b-9096-52a929140...

{
    "user_name": "zhangsan",
    "org_code": "10000",
    "name": "zhangsan",
    "mobile": "12345678901",
    "email": "zhangsan@example.com",
    "employee_id": "123456789",
    "pwd_must_modify": false,
    "first_name": "F",
    "middle_name": "M",
    "last_name": "L",
    "attr_gender": "male",
    "attr_birthday": "1990-02-01",
    "attr_nick_name": "zhangsan",
    "attr_identity_type": "id_card",
    "attr_identity_number": "123456789",
    "attr_area": "CN",
    "attr_city": "xxx",
    "attr_manager_id": "123456789",
    "attr_user_type": "regular",
    "attr_hire_date": "2021-04-01",
    "attr_work_place": "xxx",
    "user_org_relation_list": [
     {
            "orgCode": "10000",
            "relationType": 1
      },
      {
            "orgCode": "TestOrg1",
            "relationType": 0
      },
      {
            "orgCode": "TestOrg2",
            "relationType": 0
      }
    ],
    "extension": {
        "age": "18"
    }
}

Example Responses

Status code: 200

Request successful.

{
  "user_id" : "20210621095935811-5E16-6B3060..."
}

Status Codes

Status Code

Description

200

Request successful.

400

Invalid parameter.

Error Codes

See Error Codes.