Chú ý: Bạn đang xem tài liệu về giao diện REST của API. Hầu hết các thư viện ứng dụng chính thức của chúng tôi đều sử dụng gRPC. Hãy xem Giới thiệu về REST để biết chi tiết.
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.
Trang này giả định rằng bạn đã quen thuộc với Thiết kế hướng đến tài nguyên và hướng dẫn cho nhà phát triển về Tên tài nguyên, đồng thời bổ sung cho các hướng dẫn này bằng thông tin chi tiết cụ thể về cách triển khai Google Ads API.
Thiết kế hướng đến tài nguyên
Nhìn chung, API Google Ads tuân theo một thiết kế hướng đến tài nguyên, được mô hình hoá dưới dạng các tập hợp gồm tài nguyên có thể định địa chỉ riêng lẻ (danh từ của API).
Tài nguyên được tham chiếu bằng tên tài nguyên và được thao tác bằng một nhóm nhỏ phương thức (còn gọi là động từ hoặc thao tác).
Những tên tài nguyên và phương thức này, kết hợp với một tiền tố phiên bản API cụ thể, tạo thành các URL của giao diện REST.
Ví dụ: URL bên dưới có thể được chia thành các thành phần riêng lẻ theo bảng sau:
Tất cả URL REST cho một phiên bản cụ thể của API (ví dụ: v21) chia sẻ một tiền tố phiên bản API chung. Tên tài nguyên và phương thức cùng nhau xác định dịch vụ API nào đang được gọi.
API Google Ads sử dụng nhiều phương thức tuỳ chỉnh, không giống như hầu hết các API REST truyền thống sử dụng các phương thức REST tiêu chuẩn như list, get, create, update và delete. Các ví dụ về phương thức tuỳ chỉnh trong API Google Ads bao gồm search, searchStream và mutate.
Các trang sau đây sẽ trình bày chi tiết hơn về tên tài nguyên, phương thức dịch vụ và quy ước đặt tên JSON của Google Ads API để minh hoạ cách các thành phần này được dùng cùng nhau để xác định các điểm cuối giao diện REST.
[[["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-09-05 UTC."],[[["\u003cp\u003eThis guide provides Google Ads API implementation details, assuming familiarity with Resource Oriented Design and Resource Names.\u003c/p\u003e\n"],["\u003cp\u003eThe Google Ads API uses a resource-oriented design with resources organized into collections and accessed using resource names and methods.\u003c/p\u003e\n"],["\u003cp\u003eREST URLs in the API consist of an API version prefix, resource name, and method, with custom methods often used.\u003c/p\u003e\n"],["\u003cp\u003eRefer to linked resources for further details on resource names, service methods, and JSON naming conventions within the Google Ads API.\u003c/p\u003e\n"],["\u003cp\u003eExamples in the guide use HTTP; see the Examples page for \u003ccode\u003ecurl\u003c/code\u003e usage.\u003c/p\u003e\n"]]],[],null,["# REST Interface Design\n\nThis page assumes a familiarity with the [Resource Oriented\nDesign](//cloud.google.com/apis/design/resources) and [Resource\nNames](//cloud.google.com/apis/design/resource_names) developer guides and\ncomplements them with specific implementation details of the Google Ads API.\n| **Key Point:** The examples throughout this guide use HTTP protocol to demonstrate how to call the API. See the [Examples](/google-ads/api/rest/examples) page for how you can make these same API calls using the [`curl`](https://curl.haxx.se/) command line utility.\n\nResource-oriented design\n------------------------\n\nGenerally, the Google Ads API follows a resource-oriented design, modeled as\n*collections* of individually-addressable *resources* (the *nouns* of the API).\nResources are referenced with their resource names and manipulated using a small\nset of *methods* (also known as *verbs* or *operations*).\n\nThese [resource names](/google-ads/api/rest/design/resource-names) and [methods](/google-ads/api/rest/design/service-methods), combined\nwith a specific *API version prefix*, comprise the URLs of the REST interface.\nFor example, the URL below can be broken down into these individual components\naccording to the following table: \n\n https://googleads.googleapis.com/v21/customers/1234567890:mutate\n\n| API Version Prefix | Resource Name (relative) | Method |\n|----------------------------------------|--------------------------|----------|\n| `https://googleads.googleapis.com/v21` | `customers/1234567890` | `mutate` |\n\nAll REST URLs for a particular version of the API (e.g., `v21`)\nshare a common API version prefix. The resource name and method together\nidentifies which API service is being called.\n\nThe Google Ads API makes heavy use of *custom methods* , as opposed to most\ntraditional REST APIs that use standard REST methods such as `list`, `get`,\n`create`, `update`, and `delete`. Examples of custom methods in the Google Ads API\ninclude `search`, `searchStream`, and `mutate`.\n\nThe following pages go into more details about the Google Ads API's [resource\nnames](/google-ads/api/rest/design/resource-names), [service methods](/google-ads/api/rest/design/service-methods), and\n[JSON naming conventions](/google-ads/api/rest/design/json-mappings) to illustrate how they're used\ntogether to define REST interface endpoints."]]