Hiển thị APIs Explorer và thực thi một phương thức
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.
Trên hầu hết các trang tài liệu, bạn sẽ thấy một Trình khám phá API thu gọn ở phía bên phải màn hình. Nếu không thấy Trình khám phá API, hãy nhấp vào Dùng thử! để hiển thị phiên bản rút gọn của Trình khám phá API.
Nếu nút Dùng thử! không xuất hiện ở bên phải của trang tài liệu tham khảo, thì có nghĩa là phương thức đó không được APIs Explorer hỗ trợ. Ví dụ: API Explorer không tương thích với những API yêu cầu tài khoản dịch vụ, nên API này không xuất hiện trên các trang tài liệu cho những API đó.
Hiển thị phiên bản mở rộng của Trình khám phá API
Phiên bản mở rộng của Trình khám phá API có chứa cURL, HTTP và có thể là các mẫu mã khác. Để hiển thị phiên bản mở rộng của Trình khám phá API, hãy nhấp vào biểu tượng Toàn màn hình fullscreen.
Thực thi một phương thức
Trình khám phá API cho phép bạn nhập các tham số bắt buộc, tham số không bắt buộc và (nếu có) nội dung yêu cầu cho các phương thức API. Đối với nhiều phương thức REST (chẳng hạn như phương thức danh sách), bạn chỉ cần điền một hoặc hai trường trước khi có thể thực thi phương thức. Ví dụ: phương thức books.volumes.list của Books API chỉ yêu cầu một tham số truy vấn (q) để liệt kê sách. Cách thử phương thức books.volumes.list:
Nếu Trình khám phá API không xuất hiện, hãy nhấp vào Dùng thử!
Trong trường q, hãy nhập Hunger Games (không có dấu ngoặc kép hoặc ký tự đặc biệt).
Di chuyển xuống rồi nhấp vào Thực thi.
(không bắt buộc) Màn hình đăng nhập bằng Google yêu cầu bạn chọn một Tài khoản Google.
(không bắt buộc) Hộp thoại uỷ quyền của Google sẽ hỏi bạn xem bạn có muốn "Quản lý sách của bạn" hay không. Nhấp vào Cho phép. Kết quả sẽ xuất hiện bên dưới nút Thực thi.
Nếu Trình khám phá API cho thấy kết quả là 200, thì tức là phương thức đã thành công.
Khắc phục vấn đề với APIs Explorer
Bạn nhận được lỗi 401 hoặc 403
Nếu bạn gặp lỗi 401 hoặc 403 khi thực thi một phương thức bằng API Explorer, thì có thể là do một trong những vấn đề sau:
Bạn đang sử dụng sai loại uỷ quyền (khoá API thay vì OAuth 2.0).
Hãy thử chuyển đổi loại uỷ quyền.
Bạn đang sử dụng OAuth 2.0, nhưng với phạm vi quá hẹp. Hãy thử sử dụng phạm vi rộng hơn.
Hộp thoại uỷ quyền không xuất hiện
Trình khám phá API sử dụng một cửa sổ bật lên để cấp quyền truy cập vào dữ liệu riêng tư của bạn. Nếu trình duyệt của bạn chặn cửa sổ bật lên, thì cửa sổ bật lên này sẽ không xuất hiện và bạn sẽ không thể cấp quyền truy cập.
Nếu bạn nhấp vào Cho phép trong hộp thoại uỷ quyền nhưng không có gì xảy ra, hãy thử thay đổi chế độ cài đặt cửa sổ bật lên của trình duyệt để bật cửa sổ bật lên.
[[["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-26 UTC."],[[["\u003cp\u003eThe APIs Explorer allows you to test API methods directly in the documentation by providing parameters and executing requests.\u003c/p\u003e\n"],["\u003cp\u003eTo use the APIs Explorer with methods requiring authorization, you need to generate and use your own credentials.\u003c/p\u003e\n"],["\u003cp\u003eThe expanded APIs Explorer provides code samples in various formats like cURL and HTTP for easier integration.\u003c/p\u003e\n"],["\u003cp\u003eIf you encounter a 401 or 403 error, verify the authorization type and scope, as they are the most common causes.\u003c/p\u003e\n"],["\u003cp\u003eThe APIs Explorer uses popups for authorization, so ensure your browser settings allow them to function correctly.\u003c/p\u003e\n"]]],[],null,["# Display the APIs Explorer and execute a method\n\nOn most documentation pages, a condensed APIs Explorer is visible on the\nright-hand side of the screen. If the APIs Explorer isn't visible, click\n**Try it!** to display the condensed version of the APIs Explorer.\n\nIf **Try it!** doesn't appear on the right-hand side of a reference\ndocumentation page, the method isn't supported by the APIs Explorer. For\nexample, the APIs Explorer isn't compatible with APIs that require service\naccounts, so it doesn't appear on documentation pages for those APIs.\n\nDisplay the expanded version of the APIs Explorer\n-------------------------------------------------\n\nThe expanded version of the APIs Explorer contains cURL, HTTP, and possibly\nother code samples. To display the expanded version of the APIs Explorer,\nclick Full screen fullscreen.\n| **Note:** To run the code samples, you must generate and use your own authorization credentials. For an explanation of how to create a project and generate credentials, refer to your specific Google API's documentation.\n\nExecute a method\n----------------\n\nThe APIs Explorer lets you enter required parameters, optional parameters,\nand, if applicable, a request body for API methods. For many REST methods,\nsuch as list methods, you only need to fill one or two fields before you can\nexecute the method. For example, the Books API's\n[`books.volumes.list`](/books/docs/v1/reference/volumes/list)\nmethod only requires a query parameter (`q`) to list books. To try the\n[`books.volumes.list`](/books/docs/v1/reference/volumes/list)\nmethod:\n\n1. Navigate to [`books.volumes.list`](/books/docs/v1/reference/volumes/list).\n2. If the APIs Explorer isn't displayed, click **Try it!**\n3. In the **`q`** field, type *Hunger Games* (without any quotes or special characters).\n4. Scroll down and click **Execute**.\n5. (optional) A Google sign-in screen asks you to select a Google account.\n6. (optional) A Google authorization dialog asks you if it's okay to \"Manage your books.\" Click *Allow*. The results appear below the Execute button.\n\nIf the APIs Explorer shows a result of 200, then the method was successful.\n| **Note:** After you allow the authorization screen to make an authorized request, the APIs Explorer is authorized to make other requests until the credentials expire. Therefore, you don't see the authorization screen for every subsequent method call. For further information on credentials, see [Test with different credential types and scopes](/explorer-help/authorization-and-authentication).\n\nTroubleshoot APIs Explorer issues\n---------------------------------\n\n### You received a 401 or 403 error\n\nIf you're getting a 401 or 403 error when executing a method using the APIs\nExplorer, it is likely due to a problem with one of the following:\n\n- You're using the wrong authorization type (API key instead of OAuth 2.0). Try switching the authorization type.\n- You're using OAuth 2.0, but with too narrow a scope. Try using a broader scope.\n\n### Authorization dialog doesn't appear\n\nThe APIs Explorer uses a popup to grant access to your private data. If your\nbrowser blocks popups, this popup won't appear and you won't be able to grant\naccess.\n\nIf you click **Allow** in the authorization dialog and nothing happens, try\nchanging your browser's popup settings to enable popups."]]