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

Querying User Details by Username

Function

This API is used to query user details by username.

Constraints

null

URI

POST /api/v2/tenant/users/user-by-username

Request Parameters

Table 1 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 2 Request body parameters

Parameter

Mandatory

Type

Description

user_name

Yes

String

User real name.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

user_id

String

User ID.

org_id

String

Organization to which the user belongs.

user_name

String

Username.

name

String

Real name.

mobile

String

Mobile number.

email

String

Email address.

pwd_must_modify

Boolean

Whether the password must be changed upon the first login.

pwd_change_at

String

Password change time.

created_at

String

Creation time.

updated_at

String

Last modification time.

disabled

Boolean

Whether disabled.

grade

Integer

Trust level.

locked

String

Whether locked.

extension

Object

Custom extended attribute.

user_org_relation_list

Array of UserOrgRelationListResult objects

User organization relationship set.

Table 4 UserOrgRelationListResult

Parameter

Type

Description

org_id

String

Organization ID.

relation_type

String

Relationship type.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error details.

Example Requests

Query user details based on the username. The username is zhangsan.

POST https://{domain_name}/api/v2/tenant/users/user-by-username

{
  "user_name" : "zhangsan"
}

Example Responses

Status code: 200

Request successful.

{
  "user_id" : "20220413165737132-3BA0-91FCA2CB7",
  "org_id" : "20220117125622909-9346-35755733F",
  "user_name" : "zhangsan",
  "name" : "zhangsan",
  "mobile" : "12345678901",
  "email" : "zhangsan@example.com",
  "pwd_must_modify" : true,
  "pwd_change_at" : "2022-04-14 10:14:01.988",
  "created_at" : "2022-04-13 16:57:36.532",
  "updated_at" : "2022-04-14 10:14:01.979",
  "disabled" : false,
  "grade" : 1,
  "locked" : false,
  "extension" : { },
  "user_org_relation_list" : [ {
    "org_id" : "20220117125622909-9346-35755733F",
    "relation_type" : 1
  }, {
    "org_id" : "20220415103506608-AF59-5CC9081B9",
    "relation_type" : 0
  } ]
}

Status Codes

Status Code

Description

200

Request successful.

400

Invalid parameter.

Error Codes

See Error Codes.