📰
imarket校园集市
  • Welcome
  • Introduce(简介)
  • Getting Started
    • Quickstart(快速开始)
  • API
    • 安全认证
    • Auth(认证与授权)
    • Account(账户管理)
    • Admin(管理员功能)
    • Post(帖子管理)
    • User(用户相关)
    • Comments(评论管理)
    • Message(站内消息)
    • Image(图片管理)
    • Search(搜索功能)
  • Plugin
    • Introduce(插件系统简介)
    • Start(快速上手)
    • Dependency Injection(依赖注入)
    • API (状态接口)
  • Database
    • Tables(数据库表结构)
    • create_tables_script(数据库创建脚本)
Powered by GitBook
On this page
  • GET /api/Account/Info
  • POST /api/Account/Edit
  1. API

Account(账户管理)

GET /api/Account/Info

  • 描述: 获取账户信息。

  • 响应: 200 OK

请求示例

const myHeaders = new Headers();
myHeaders.append("Authorization", "<API Key>");

const requestOptions = {
  method: "GET",
  headers: myHeaders,
  redirect: "follow"
};

fetch("//api/Account/Info", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

返回示例

{
  "success": true,
  "account": {
    "username": "admin",
    "nickname": "admin imarket",
    "avatar": "/images/defaultAvatar.png",
    "email": "imarket@imarket.com",
    "status": 1
  }
}

POST /api/Account/Edit

  • 描述: 编辑账户信息。

  • 请求体:

    • application/json: EditRequest 对象

    • text/json: EditRequest 对象

    • application/*+json: EditRequest 对象

  • 响应: 200 OK

请求示例

{
  "nickname": "<string>",
  "avatar": "<string>",
  "email": "<string>"
}

示例代码

const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "<API Key>");

const raw = JSON.stringify({
  "nickname": "<string>",
  "avatar": "<string>",
  "email": "<string>"
});

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: raw,
  redirect: "follow"
};

fetch("//api/Account/Edit", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));

返回示例

{
  "success": true
}
PreviousAuth(认证与授权)NextAdmin(管理员功能)

Last updated 4 months ago