外观
用户资料查询
第三方应用或普通用户可以通过此接口查询其他用户的公开资料。本接口不需要任何鉴权凭证,任何人都可以调用,适用于展示用户个人主页等场景。
类似 B 站等平台的「他人个人主页」功能。
前置条件
无。本接口为完全公开接口,无需 Token、TID 或 SecretKey。
接口定义
POST /third-party/user/profile — 获取用户公开资料
根据用户名查询用户的公开信息,包括昵称、头像、糖果数以及封禁状态等。
接口地址:POST https://api.notanote.cn/third-party/user/profile
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
Name | string | 是 | 要查询的 Notanote 用户名 |
请求示例
json
{
"Name": "player1"
}成功响应
json
{
"Status": true,
"Response": {
"Identifier": "nano.api.v2.user.profile.succeed",
"Data": {
"UID": 2,
"Name": "Demo",
"NickName": "测试人员",
"Avatar": "No.38",
"Candy": "999999",
"Type": [
"Beta"
],
"IsBanned": false
}
}
}| 字段 | 类型 | 说明 |
|---|---|---|
UID | number | 用户唯一 ID |
Name | string | 用户名 |
NickName | string | 用户昵称 |
Avatar | string | 用户头像标识(如 "No.38") |
Candy | string | 用户糖果数 |
Type | string[] | 用户类型标签(如 ["Beta"]) |
IsBanned | boolean | 是否被封禁 |
失败情况
本接口目前不会返回业务层错误。若查询的用户不存在,返回空数据。
调用示例
js
async function getUserProfile(name) {
const res = await fetch('https://api.notanote.cn/third-party/user/profile', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ Name: name }),
});
const data = await res.json();
if (!data.Status) {
throw new Error(`查询失败: ${data.Response.Identifier}`);
}
return data.Response.Data;
}
// 使用示例
const profile = await getUserProfile('player1');
console.log(profile.NickName); // "玩家一"
console.log(profile.IsBanned ? '已封禁' : '正常');