Method: scores.get
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Đạt điểm cao và xếp hạng theo tùy chọn trong bảng xếp hạng cho người chơi hiện đã được xác thực. Đối với một khoảng thời gian cụ thể, bạn có thể thiết lập leaderboardId
thành ALL
để truy xuất dữ liệu cho tất cả các bảng xếp hạng trong một khoảng thời gian nhất định. `LƯU Ý: Bạn không thể yêu cầu bảng xếp hạng 'TẤT CẢ' và khoảng thời gian 'TẤT CẢ' trong cùng một yêu cầu; chỉ có thể đặt một tham số thành 'TẤT CẢ'.
Yêu cầu HTTP
GET https://games.googleapis.com/games/v1/players/{playerId}/leaderboards/{leaderboardId}/scores/{timeSpan}
Tham số đường dẫn
Các tham số |
playerId |
string
Mã nhận dạng người chơi. Giá trị của me có thể được sử dụng thay cho mã của người chơi đã xác thực.
|
leaderboardId |
string
Mã của bảng xếp hạng. Có thể đặt thành 'TẤT CẢ' để truy xuất dữ liệu cho tất cả các bảng xếp hạng cho ứng dụng này.
|
timeSpan |
enum (ScoreTimeSpan )
Khoảng thời gian cho điểm số và thứ hạng mà bạn yêu cầu.
|
Tham số truy vấn
Các tham số |
language |
string
Ngôn ngữ ưu tiên dùng cho các chuỗi được phương thức này trả về.
|
includeRankType |
enum (IncludeRankType )
Các loại thứ hạng cần trả về. Nếu tham số này bị bỏ qua, thì hệ thống sẽ không trả về thứ hạng.
|
maxResults |
integer
Số điểm bảng xếp hạng tối đa cần trả về trong câu trả lời. Đối với mọi câu trả lời, số điểm thực tế trên bảng xếp hạng được trả về có thể nhỏ hơn maxResults đã chỉ định.
|
pageToken |
string
Mã thông báo được yêu cầu trước đó trả về.
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Nếu thành công, nội dung phản hồi sẽ chứa một phiên bản của GetLeaderboardScoresResponse
.
Phạm vi uỷ quyền
Yêu cầu một trong các phạm vi OAuth sau:
https://www.googleapis.com/auth/games
https://www.googleapis.com/auth/games_lite
Để biết thêm thông tin, hãy xem Tổng quan về OAuth 2.0.
ScoreTimeSpan
Xác định các khoảng thời gian có thể có cho một điểm số.
Enum |
ALL |
Nhận điểm số cao trong mọi khoảng thời gian. Nếu thuộc tính này được sử dụng, các giá trị maxResults sẽ bị bỏ qua. |
ALL_TIME |
Nhận điểm số cao nhất từ trước đến nay. |
WEEKLY |
Liệt kê các điểm số cao nhất cho ngày hiện tại. |
DAILY |
Liệt kê các điểm số cao nhất trong tuần hiện tại. |
IncludeRankType
Giá trị có thể cho loại xếp hạng.
Enum |
ALL |
Truy xuất tất cả các thứ hạng được hỗ trợ. Trong HTTP, giá trị tham số này cũng có thể được chỉ định là ALL . |
PUBLIC |
Truy xuất thứ hạng công khai nếu người chơi chia sẻ công khai hoạt động chơi của họ. |
SOCIAL |
(Lỗi thời) Truy xuất thứ hạng xã hội. |
FRIENDS |
Truy xuất thứ hạng trên bộ sưu tập bạn bè. |
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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. |"]]