RankHub

API 目前处于 Early Preview 阶段, 可能存在诸多不完善与错误之处,欢迎加群交流反馈:加入官方交流群(1073434398)

怎么传数据(速查)

建档、推成绩、改档案时到底该传哪套字段:RankHub 格式还是 native,每个游戏哪些字段必填、哪些不能传。

RankHub 的写入接口只认两种数据形状,二选一即可(也可以混用,native 优先):

RankHub 格式游戏原生格式(native)
长什么样顶层 player / scores[] 的 camelCase 字段player.native / scores[].native 里放游戏原生对象
适合谁你自己算好了字段、或从别处拿到归一数据你手里直接是游戏存档 / 官方 API / 机台数据
谁做换算你自己服务端(每游戏一套固定规则)
身份 / 唯一键顶层身份字段(必填)仍然取顶层;native 里出现会被忽略或在 PATCH 时报 400

决策树

你手里的数据是什么?
├─ 已经是游戏原生对象(存档 / 官方 API / 机台导出)
│   ├─ 建档 → POST /v1/games/{game}/profiles      { player: { native: {...} } }
│   ├─ 推成绩 → POST .../profiles/{id}/scores     { scores: [ { native: {...} } ] }
│   └─ 改档案 → PATCH .../profiles/{id}           { native: {...} }
└─ 已经是你自己算好的归一字段
    ├─ 建档 → { player: { name, ...身份字段 } }
    ├─ 推成绩 → { scores: [{ songId, difficulty, score/rating, ... }] }
    └─ 改档案 → { name?, isPublic? }

请求示例

以 maimai 为例,同一件事两种写法(native 优先;顶层身份字段仍然必填)。

RankHub 格式

{ "player": { "friendCode": "1234567890123", "name": "Player" } }

游戏原生格式(native)

{ "player": { "native": { "friend_code": "1234567890123", "user_name": "Player" } } }

每游戏速查

游戏建档身份字段(必填)成绩唯一键(必填)native 建档native 成绩详细
maimaifriendCode 或 userIdsongId + type + levelIndex支持(整份玩家对象)支持 机台载荷maimai
chunithmfriendCodesongId + difficulty支持(整份玩家对象)—(只认 LXNS 兼容字段成绩)chunithm
arcaeaarcaeaId + charactersongId + difficulty支持支持arcaea
phigrosobjectIdsongId + difficulty支持支持phigros
milthmmilthmUserId + regionsongId/chartId支持支持milthm
notanotenotanoteUidchartKey支持支持notanote
musedashmusedashUiduid支持支持musedash
rizlineplayerIdtrackId + difficulty支持支持rizline
osuosuUserIdsongId(beatmap id)支持支持osu
orzmicexternalIdsongId + difficulty支持(整份玩家对象)支持(原样进 native)orzmic

身份字段与成绩唯一键不能通过 native 改;native 只负责其余字段(显示名、头像、名牌、potential、 判定/评分等)。逐字段清单与示例见各游戏页的「原生数据(native)」与「写入(第三方)」。

每个游戏必给什么

游戏scores[] 必给单曲评分来源比较值(只升不降)
maimaisongId + achievements(+type/levelIndex)服务端算achievements
arcaeasongId + difficulty + score + clearType服务端算score
phigrossongId + difficulty + score + accuracy + rating调用方给score
milthmsongId + difficulty + score + accuracy + rating调用方给score
notanotesongId + difficulty + accuracy + rating调用方给score
musedashsongId + difficulty + score + accuracy + rating调用方给score
rizlinesongId + difficulty + score + rating调用方给score
osusongId + mode + rating(pp)+ accuracy + score调用方给rating
chunithmsongId + difficulty + rating + bucket(建议带 native)调用方给score
orzmicsongId + difficulty + rating + native调用方给score

"必给" = 缺失会按 0/默认值落库并写出错误成绩(phigros 的 difficulty 不合法会直接 400)。 字段精确类型/单位见各游戏格式页。

三条通用规则

  1. native 与顶层字段同时出现时 native 优先;只给 native 时,顶层身份字段仍必须给。
  2. 非法值不静默丢弃:返回 400 common.invalidArgument,message 里带具体字段名(如 native.achievement)。
  3. 派生评分不代算:rating / rks / reality / nrk / performance 由你按既有契约给; maimai / arcaea 例外(服务端算)。

修改已有档案

PATCH /v1/games/{game}/profiles/{profileId}

可改 name / isPublic / native(native 里可放除身份字段外的所有展示字段); 身份字段变化 ⇒ 400。详见游戏档案 · 修改档案。

本页内容

官方交流群二维码官方交流群问题反馈 · 版本资讯 · 成绩交流群号 1073434398