Method: achievements.unlock
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.
Mở khóa thành tích này cho người chơi hiện đã được xác thực.
Yêu cầu HTTP
POST https://games.googleapis.com/games/v1/achievements/{achievementId}/unlock
Tham số đường dẫn
Tham số |
achievementId |
string
Mã của thành tích mà phương thức này sử dụng.
|
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
Phản hồi mở khoá thành tích
Nếu thành công, phần nội dung phản hồi sẽ chứa dữ liệu có cấu trúc sau:
Biểu diễn dưới dạng JSON |
{
"kind": string,
"newlyUnlocked": boolean
} |
Trường |
kind |
string
Xác định duy nhất loại tài nguyên này. Giá trị luôn là chuỗi games#achievementUnlockResponse cố định.
|
newlyUnlocked |
boolean
Liệu thành tích này có phải là thành tích mới được mở khóa hay không (nghĩa là yêu cầu mở khóa cho thành tích này có phải là yêu cầu đầu tiên của người chơi hay không).
|
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 bài viết Tổng quan về OAuth 2.0.
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.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# Method: achievements.unlock\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.UnlockAchievementResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUnlocks this achievement for the currently authenticated player.\n\n### HTTP request\n\n`POST https://games.googleapis.com/games/v1/achievements/{achievementId}/unlock`\n\n### Path parameters\n\n| Parameters ||\n|-----------------|---------------------------------------------------------|\n| `achievementId` | `string` The ID of the achievement used by this method. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nAn achievement unlock response\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|------------------------------------------------------|\n| ``` { \"kind\": string, \"newlyUnlocked\": boolean } ``` |\n\n| Fields ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `kind` | `string` Uniquely identifies the type of this resource. Value is always the fixed string `games#achievementUnlockResponse`. |\n| `newlyUnlocked` | `boolean` Whether this achievement was newly unlocked (that is, whether the unlock request for the achievement was the first for the player). |\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)."]]