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.
Discovery API cung cấp danh sách các API của Google để truy xuất siêu dữ liệu "Tài liệu khám phá" có thể đọc được bằng máy cho từng API.
Tài liệu này dành cho những nhà phát triển muốn viết thư viện ứng dụng, trình bổ trợ IDE và các công cụ khác để tương tác với API của Google.
Nền tảng của dịch vụ khám phá
Khái niệm
Dịch vụ Khám phá API của Google được xây dựng dựa trên 2 khái niệm cơ bản:
Thư mục API: Danh sách tất cả các API được Dịch vụ Khám phá API hỗ trợ. Mỗi mục trong thư mục đều cho biết thông tin chi tiết về một API được hỗ trợ, bao gồm cả tên, nội dung mô tả ngắn gọn về chức năng và đường liên kết đến tài liệu. Một API có thể có nhiều mục trong Thư mục, mỗi mục cho một phiên bản được hỗ trợ.
Tài liệu khám phá: Nội dung mô tả mà máy có thể đọc được về một API cụ thể.
Tài liệu Khám phá mô tả nền tảng cho một phiên bản cụ thể của API. Tài liệu này cung cấp thông tin chi tiết về cách truy cập vào nhiều phương thức của từng API thông qua các lệnh gọi HTTP tuân theo REST. Tài liệu Khám phá bao gồm nội dung mô tả về dữ liệu và phương thức liên kết với API, cũng như thông tin về các phạm vi OAuth hiện có và nội dung mô tả về lược đồ, phương thức, tham số và giá trị tham số hiện có.
Mô hình dữ liệu
Tài nguyên là một thực thể dữ liệu riêng lẻ có giá trị nhận dạng riêng biệt. Dịch vụ Khám phá API của Google hoạt động trên 2 loại tài nguyên, dựa trên các khái niệm nêu trên.
Danh sách thư mục API: Danh sách API
Mỗi mục nhập trong thư mục chứa một cặp tên/phiên bản API kèm theo thông tin sau:
Thông tin nhận dạng và mô tả: tên, phiên bản, tiêu đề và nội dung mô tả.
Thông tin về tài liệu: biểu tượng và đường liên kết đến tài liệu.
Thông tin trạng thái, bao gồm cả nhãn trạng thái và thông tin cho biết đây có phải là phiên bản API ưu tiên hay không.
Đường liên kết đến tài liệu khám phá, URI của tài liệu khám phá cho API này (được cung cấp dưới dạng một URL đầy đủ – ví dụ: https://serviceusage.googleapis.com/$discovery/rest?version=v1).
Tài nguyên Tài liệu khám phá: Nội dung mô tả có thể đọc được bằng máy về một API cụ thể
Ngoài thông tin có trong Thư mục API, tài liệu Khám phá cũng bao gồm:
Giản đồ, là danh sách các giản đồ tài nguyên API mô tả dữ liệu mà bạn có quyền truy cập trong mỗi API; giản đồ của Dịch vụ Khám phá API của Google dựa trên Giản đồ JSON.
Phương thức, bao gồm danh sách các phương thức API và các tham số có sẵn cho từng phương thức.
Phạm vi OAuth, xác định danh sách phạm vi OAuth có sẵn cho API này.
Tài liệu nội tuyến, cung cấp nội dung mô tả ngắn gọn về các giản đồ, phương thức, tham số và giá trị tham số có sẵn.
Directory Collection là vùng chứa khái niệm của tài nguyên Directory API duy nhất và tài nguyên Discovery Document cho từng API được hỗ trợ.
Hoạt động tính toán
Bạn có thể gọi 2 phương thức khác nhau trên các tập hợp và tài nguyên trong Dịch vụ Khám phá API của Google, như mô tả trong bảng sau.
Hoạt động
Mô tả
Mối liên kết HTTP REST
list
Liệt kê tất cả các API được hỗ trợ.
GET trên URI tài nguyên Thư mục.
Kiểu gọi
REST
Các thao tác được hỗ trợ của Dịch vụ Khám phá API của Google có liên hệ trực tiếp đến động từ GET HTTP REST, như mô tả trong phần Thao tác.
Định dạng cụ thể cho URI của Dịch vụ Khám phá API của Google là:
https://API/$discovery/rest?version=VERSION
trong đó API là giá trị nhận dạng cho một tài nguyên Tài liệu khám phá và VERSION là giá trị nhận dạng của phiên bản cụ thể của API.
Sau đây là một vài ví dụ về cách hoạt động của dịch vụ này trong Dịch vụ Khám phá API của Google.
Liệt kê tất cả các API được Dịch vụ Khám phá API của Google hỗ trợ:
GET https://discovery.googleapis.com/discovery/v1/apis
[[["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 Google Discovery API provides machine-readable metadata ("Discovery documents") for various Google APIs, aiding developers in building client libraries and tools.\u003c/p\u003e\n"],["\u003cp\u003eThe service relies on an APIs Directory, listing available APIs, and Discovery documents detailing each API's structure, methods, and schemas.\u003c/p\u003e\n"],["\u003cp\u003eDiscovery documents employ JSON Schema to describe data structures and offer inline documentation for better understanding.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve the APIs Directory or a specific API's Discovery document through simple RESTful HTTP GET requests.\u003c/p\u003e\n"],["\u003cp\u003eThe service is publicly accessible for general API discovery, though private APIs may require authentication.\u003c/p\u003e\n"]]],[],null,["# Overview of the Discovery API\n\nThe Discovery API provides a list of Google APIs for retrieving a machine-readable \"Discovery\ndocument\" metadata for each API.\n\n\nThis document is intended for developers who want to write client libraries, IDE plugins, and\nother tools for interacting with Google APIs.\n\nDiscovery Service Background\n----------------------------\n\n### Concepts\n\nThe Google APIs Discovery Service is built upon two basic concepts:\n\n- **APIs Directory** : A list of all APIs that are supported by the APIs Discovery Service. Each directory entry shows details about a supported API, including its *name* , a brief *description* of what it does, and a *documentation\n link*. An API can have multiple Directory entries, one for each of its supported versions.\n- **Discovery document**: A machine-readable description of a particular API. The Discovery document describes the surface for a particular version of an API. The document provides details on how to access the various methods of each API via RESTful HTTP calls. A Discovery document includes descriptions of the data and methods associated with the API, as well as information about available OAuth scopes, and descriptions of schemas, methods, parameters and available parameter values.\n\n### Data model\n\n\nA resource is an individual data entity with a unique identifier. The Google APIs Discovery Service operates on\ntwo types of resources, based on the above concepts.\n\n#### APIs Directory List: A list of APIs\n\n\nEach directory entry contains an API **name** /**version** pair with the\nfollowing information:\n\n- **Identification and description information,**: name, version, title, and description.\n- **Documentation information**: icons and a documentation link.\n- **Status information**, including status labels, and an indication as to whether or not this is the preferred version of the API.\n- **Discovery document link** , the URI of the discovery document for this API (given as a full URL---for example, `https://serviceusage.googleapis.com/$discovery/rest?version=v1`).\n\n#### Discovery Document resource: A machine-readable description of a particular API\n\n\nIn addition to the information provided in the APIs Directory, a Discovery document also\nincludes:\n\n- **Schemas** , which is a list of API resource schemas that describe the data you have access to in each API; the Google APIs Discovery Service schemas are based on [JSON Schema](https://json-schema.org/).\n- **Methods**, including a list of API methods and available parameters for each method.\n- **OAuth scopes**, which identifies the list of OAuth scopes available for this API.\n- **Inline documentation**, which provides brief descriptions of schemas, methods, parameters and available parameter values.\n\n\nThe single Directory Collection is the conceptual container of the single APIs Directory\nresource, and the Discovery Document resources for each supported API.\n\n### Operations\n\n\nYou can invoke two different methods on collections and resources in the Google APIs Discovery Service, as\ndescribed in the following table.\n\n| Operation | Description | REST HTTP mappings |\n|-----------|---------------------------|--------------------------------------|\n| list | Lists all supported APIs. | `GET` on the Directory resource URI. |\n\nCalling style\n-------------\n\n| **Note:** Public APIs *do not* need authentication. Private APIs require an [API key](https://cloud.google.com/docs/authentication/api-keys).\n\n### REST\n\n\nThe supported Google APIs Discovery Service operations map directly to the [REST](https://en.wikipedia.org/wiki/Representational_State_Transfer) HTTP\n`GET` verb, as described in [Operations](#background-operations).\n\nThe specific format for Google APIs Discovery Service URIs are: \n\n```\nhttps://API/$discovery/rest?version=VERSION\n```\n\n\nwhere \u003cvar translate=\"no\"\u003eAPI\u003c/var\u003e is the identifier for a Discovery Document resource, and\n\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e is the identifier of the particular version of the API.\n\nHere are a couple of examples of how this works in the Google APIs Discovery Service.\n\nList all the Google APIs Discovery Service supported APIs: \n\n```\nGET https://discovery.googleapis.com/discovery/v1/apis\n```\n\n\n[Try it now in APIs Explorer!](//developers.google.com/apis-explorer/#p/discovery/v1/discovery.apis.list)\n\nGet the Discovery document for Service Usage API, version 1: \n\n```\nGET https://serviceusage.googleapis.com/$discovery/rest?version=v1\n```"]]