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.

Points to note

  • The API uses the POST method and requires data to be submitted in application/ format
  • You need to log in as a user before you can call this interface
  • All parameters are optional, you can only update the fields that need to be modified
  • 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:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/user/detail

Request Syntax

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

Request Headers

This interface also involves common request headers. For more information, please refer toCommon 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 header

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

Return parameters

Field name Type Description
code int Error code
msg string Error description

Usage Example

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 at the same time

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 Not authorized
200 API request OK