Method: scores.get
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
รับคะแนนสูงสุดและจัดอันดับ (ไม่บังคับ) ในลีดเดอร์บอร์ดสำหรับผู้เล่นที่ตรวจสอบสิทธิ์อยู่ในปัจจุบัน สำหรับช่วงเวลาที่เฉพาะเจาะจง คุณสามารถตั้งค่า leaderboardId
เป็น ALL
เพื่อดึงข้อมูลของลีดเดอร์บอร์ดทั้งหมดในช่วงเวลาที่กำหนด "หมายเหตุ: คุณไม่สามารถขอลีดเดอร์บอร์ด "ทั้งหมด" และช่วงเวลา "ทั้งหมด" ในคำขอเดียวกัน เนื่องจากสามารถตั้งค่าพารามิเตอร์เป็น "ทั้งหมด" ได้เพียงพารามิเตอร์เดียวเท่านั้น
คำขอ HTTP
GET https://games.googleapis.com/games/v1/players/{playerId}/leaderboards/{leaderboardId}/scores/{timeSpan}
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
playerId |
string
รหัสผู้เล่น ระบบอาจใช้ค่า me แทนรหัสของโปรแกรมเล่นที่ตรวจสอบสิทธิ์แล้ว
|
leaderboardId |
string
รหัสของลีดเดอร์บอร์ด สามารถตั้งค่าเป็น "ทั้งหมด" เพื่อดึงข้อมูลลีดเดอร์บอร์ดทั้งหมดสำหรับแอปพลิเคชันนี้
|
timeSpan |
enum (ScoreTimeSpan )
ช่วงเวลาสำหรับคะแนนและอันดับที่คุณขอ
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
language |
string
ภาษาที่ต้องการใช้สำหรับสตริงที่แสดงผลโดยวิธีนี้
|
includeRankType |
enum (IncludeRankType )
ประเภทของอันดับที่จะแสดงผล หากละเว้นพารามิเตอร์ จะไม่มีการแสดงอันดับ
|
maxResults |
integer
จำนวนคะแนนลีดเดอร์บอร์ดสูงสุดที่จะแสดงในการตอบกลับ สำหรับการตอบกลับใดๆ จำนวนคะแนนลีดเดอร์บอร์ดที่แสดงผลจริงอาจน้อยกว่า maxResults ที่ระบุไว้
|
pageToken |
string
โทเค็นที่แสดงผลโดยคำขอก่อนหน้า
|
เนื้อหาของคำขอ
เนื้อหาของคำขอต้องว่างเปล่า
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ GetLeaderboardScoresResponse
ขอบเขตการให้สิทธิ์
ต้องมีขอบเขต OAuth อย่างใดอย่างหนึ่งต่อไปนี้
https://www.googleapis.com/auth/games
https://www.googleapis.com/auth/games_lite
ดูข้อมูลเพิ่มเติมได้ที่ภาพรวมของ OAuth 2.0
ScoreTimeSpan
ระบุระยะเวลาที่อาจเป็นไปได้สำหรับการให้คะแนน
Enum |
ALL |
รับคะแนนสูงสุดในทุกช่วงเวลา หากใช้ตัวเลือกนี้ ระบบจะไม่สนใจค่า maxResults |
ALL_TIME |
ทำคะแนนสูงสุดตลอดกาล |
WEEKLY |
แสดงรายการคะแนนสูงสุดของวันปัจจุบัน |
DAILY |
แสดงรายการคะแนนสูงสุดของสัปดาห์ปัจจุบัน |
IncludeRankType
ค่าที่เป็นไปได้สำหรับประเภทอันดับ
Enum |
ALL |
ดึงข้อมูลอันดับที่รองรับทั้งหมด ใน HTTP คุณระบุค่าพารามิเตอร์นี้เป็น ALL ได้ด้วย |
PUBLIC |
เรียกข้อมูลอันดับแบบสาธารณะหากผู้เล่นแชร์กิจกรรมการเล่นเกมแบบสาธารณะ |
SOCIAL |
(ล้าสมัย) ดึงข้อมูลอันดับทางสังคม |
FRIENDS |
ดึงข้อมูลอันดับในคอลเล็กชันเพื่อน |
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],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. |"]]