Update User Information Interface

Update the basic information of the currently logged-in user, including username, real name, personal introduction, email, and phone number, etc.

Precautions

  • This interface uses the POST method and requires data to be submitted in application/ format
  • You need to log in as a user to call this interface
  • All parameters are optional, only the fields that need to be updated can be updated
  • Username, email, and phone number may require uniqueness verification
  • The operation result will be returned after the update is successful

Request address

{域名地址}/api/user/detail

Description:{域名地址}Need to replace it with your domain address, such ashttps://en.anqicms.com/api/user/detail

Request syntax

POST {域名地址}/api/user/detail
Content-Type: application/json

Request header

This interface also involves common request headers. For more information, please seeCommon Request Headers (Common Request Headers).

Request Parameters

Field Name Type Required Description
user_name string No Username, if not provided, this item will not be updated
Real Name string No Real name, if not provided, this item will not be updated
introduce string No User introduction, if not provided, this item will not be updated
email string No Email address, if not provided, this item will not be updated
phone string No Phone number, if not provided, this item will not be updated

Response Headers

This interface only involves public response headers. More information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field Name Type Description
code integer Error code
message string Error Description

Example Usage

Request Example

Update username and real name

POST /api/user/detail HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "user_name": "new_username",
  "real_name": "张三"
}

Update email and phone number

POST /api/user/detail HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "email": "[email protected]",
  "phone": "13800138000"
}

Update personal introduction

POST /api/user/detail HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "introduce": "这是一段新的个人介绍"
}

Update multiple fields simultaneously

POST /api/user/detail HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json

{
  "user_name": "updated_user",
  "real_name": "李四",
  "email": "[email protected]",
  "phone": "13900139000",
  "introduce": "更新后的个人介绍"
}

Response Example

Successful response

{
  "code": 0,
  "msg": "保存成功"
}

Failed response

{
  "code": -1,
  "msg": "用户名已存在"
}

Error Code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Unauthorized
200 API request OK