Method: scores.get
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
获取当前已通过身份验证的玩家在排行榜中的最高得分和排名(可选)。对于特定时间跨度,可以将 leaderboardId
设置为 ALL
,以检索给定时间跨度内所有排行榜的数据。`注意:您不能在同一请求中请求“所有”排行榜和“所有”时间跨度;只能将一个参数设置为“所有”。
HTTP 请求
GET https://games.googleapis.com/games/v1/players/{playerId}/leaderboards/{leaderboardId}/scores/{timeSpan}
路径参数
参数 |
playerId |
string
玩家 ID。可以使用值 me 来代替经过身份验证的玩家的 ID。
|
leaderboardId |
string
排行榜的 ID。可设置为“ALL”,以检索此应用的所有排行榜的数据。
|
timeSpan |
enum (ScoreTimeSpan )
您请求的得分和排名所涵盖的时间范围。
|
查询参数
参数 |
language |
string
此方法返回的字符串的首选语言。
|
includeRankType |
enum (IncludeRankType )
要返回的排名类型。如果省略此参数,则不会返回任何排名。
|
maxResults |
integer
响应中可返回的排行榜得分数量上限。对于任何响应,返回的排行榜得分实际数量可能少于指定的 maxResults 。
|
pageToken |
string
上一个请求返回的令牌。
|
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/games
https://www.googleapis.com/auth/games_lite
如需了解详情,请参阅 OAuth 2.0 概览。
ScoreTimeSpan
枚举 |
ALL |
获取所有时间跨度的最高得分。如果使用此参数,系统会忽略 maxResults 值。 |
ALL_TIME |
获取历史最高分。 |
WEEKLY |
列出当天的最高分数。 |
DAILY |
列出本周的最高分数。 |
IncludeRankType
枚举 |
ALL |
检索所有受支持的排名。在 HTTP 中,此参数值还可以指定为 ALL 。 |
PUBLIC |
检索公开排名(如果玩家公开分享其游戏活动)。 |
SOCIAL |
(已废弃)检索社交排名。 |
FRIENDS |
检索好友集合的排名。 |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Method: scores.get\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [ScoreTimeSpan](#ScoreTimeSpan)\n- [IncludeRankType](#IncludeRankType)\n- [Try it!](#try-it)\n\nGet high scores, and optionally ranks, in leaderboards for the currently authenticated player. For a specific time span, `leaderboardId` can be set to `ALL` to retrieve data for all leaderboards in a given time span. \\`NOTE: You cannot ask for 'ALL' leaderboards and 'ALL' timeSpans in the same request; only one parameter may be set to 'ALL'.\n\n### HTTP request\n\n`GET https://games.googleapis.com/games/v1/players/{playerId}/leaderboards/{leaderboardId}/scores/{timeSpan}`\n\n### Path parameters\n\n| Parameters ||\n|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------|\n| `playerId` | `string` A player ID. A value of `me` may be used in place of the authenticated player's ID. |\n| `leaderboardId` | `string` The ID of the leaderboard. Can be set to 'ALL' to retrieve data for all leaderboards for this application. |\n| `timeSpan` | `enum (`[ScoreTimeSpan](/games/services/web/api/rest/v1/scores/get#ScoreTimeSpan)`)` The time span for the scores and ranks you're requesting. |\n\n### Query parameters\n\n| Parameters ||\n|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `language` | `string` The preferred language to use for strings returned by this method. |\n| `includeRankType` | `enum (`[IncludeRankType](/games/services/web/api/rest/v1/scores/get#IncludeRankType)`)` The types of ranks to return. If the parameter is omitted, no ranks will be returned. |\n| `maxResults` | `integer` The maximum number of leaderboard scores to return in the response. For any response, the actual number of leaderboard scores returned may be less than the specified `maxResults`. |\n| `pageToken` | `string` The token returned by the previous request. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [GetLeaderboardScoresResponse](/games/services/web/api/rest/v1/scores#GetLeaderboardScoresResponse).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/games`\n- `\n https://www.googleapis.com/auth/games_lite`\n\nFor more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2).\n\nScoreTimeSpan\n-------------\n\nDefines possible time spans for a score.\n\n| Enums ||\n|------------|---------------------------------------------------------------------------------------------|\n| `ALL` | Get the high scores for all time spans. If this is used, maxResults values will be ignored. |\n| `ALL_TIME` | Get the all time high score. |\n| `WEEKLY` | List the top scores for the current day. |\n| `DAILY` | List the top scores for the current week. |\n\nIncludeRankType\n---------------\n\nPossible values for rank type.\n\n| Enums ||\n|-----------|---------------------------------------------------------------------------------------------|\n| `ALL` | Retrieve all supported ranks. In HTTP, this parameter value can also be specified as `ALL`. |\n| `PUBLIC` | Retrieve public ranks, if the player is sharing their gameplay activity publicly. |\n| `SOCIAL` | (Obsolete) Retrieve the social rank. | This item is deprecated! |\n| `FRIENDS` | Retrieve the rank on the friends collection. |"]]