注意:您正在查看 API 的 REST 介面說明文件。我們的官方用戶端程式庫支援 gRPC。詳情請參閱
REST 簡介。
服務方法
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google Ads API 的設計與傳統 REST 架構不同,因為它主要使用自訂方法,例如 search
和 mutate,
,而非較傳統的 list
、get
、create
、update
和 delete
方法。這些動作會以 REST 網址表示,方法是使用 HTTP 對應慣例,以 :
將自訂動詞與網址的其餘部分分開。
舉例來說,廣告活動變動 API 呼叫會使用下列網址:
https://googleads.googleapis.com/v21/customers/1234567890/campaigns:mutate
API 使用自訂方法的原因之一,是為了將多項作業分批處理為單一 API 要求。嚴格的 REST 語意一次只能更新一個廣告活動。舉例來說,如果使用傳統 REST update
對廣告活動執行作業,您必須為每個廣告活動資源傳送一個 HTTP PATCH 要求。
為了允許在單一要求主體中將多項作業捆綁在一起,Google Ads API 會為大多數資源定義自訂 mutate
方法。同樣地,如要從 API 啟用批次讀取 (一次擷取多個物件),API 會使用自訂 search
方法和類似 SQL 的 Google Ads 查詢語言。
「常用方法」頁面詳細說明 Google Ads API 中最常使用的方法。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[null,null,["上次更新時間:2025-08-27 (世界標準時間)。"],[[["\u003cp\u003eThe Google Ads API utilizes custom methods like \u003ccode\u003esearch\u003c/code\u003e and \u003ccode\u003emutate\u003c/code\u003e instead of standard REST methods for efficiency and batch operations.\u003c/p\u003e\n"],["\u003cp\u003eThis approach allows for updating multiple campaigns or fetching numerous objects within a single request, unlike traditional REST.\u003c/p\u003e\n"],["\u003cp\u003eCustom methods are expressed in REST URLs using a colon to separate the verb from the rest of the URL, for example, \u003ccode\u003ehttps://googleads.googleapis.com/v18/customers/1234567890/campaigns:mutate\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eBatching operations, like updating many campaigns simultaneously, are enabled through the custom \u003ccode\u003emutate\u003c/code\u003e method, improving efficiency over individual requests.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esearch\u003c/code\u003e method uses a SQL-like query language for batch reads, enabling retrieval of multiple objects in one API call.\u003c/p\u003e\n"]]],["The Google Ads API uses custom methods like `search` and `mutate` instead of standard REST methods (e.g., `list`, `get`). This is indicated in URLs by a `:` separator. `Mutate` enables batching multiple operations into one request, unlike standard `update`, which handles one campaign at a time. Similarly, `search` allows fetching multiple objects in a single request, utilizing a SQL-like query language. This deviates from REST conventions to facilitate efficient batch processing and querying.\n"],null,["# Service Methods\n\nThe design of the Google Ads API differs from a traditional REST architecture\nbecause it primarily uses custom methods, such as `search` and `mutate,` instead\nof the more traditional `list`, `get`, `create`, `update`, and `delete` methods.\nThese actions are expressed in REST URLs by using the [HTTP mapping](https://cloud.google.com/apis/design/custom_methods#http_mapping)\nconvention of a `:` to separate the custom verb from the rest of the URL.\n\nFor example, a campaign mutate API call uses the following URL: \n\n https://googleads.googleapis.com/v21/customers/1234567890/campaigns:mutate\n\nOne reason that the API uses custom methods is to enable batching of multiple\noperations into a single API request. Strict REST semantics would only allow\nupdating one campaign at a time. A traditional REST\n[`update`](https://cloud.google.com/apis/design/standard_methods#update) to a\ncampaign, for example, would require sending one HTTP PATCH request per campaign\nresource.\n\nTo allow many operations to be bundled together within a single request body,\nthe Google Ads API instead defines a custom `mutate` method for most resources.\nSimilarly, to enable batch reads (fetching many objects at once) from the API,\nthe API uses a custom `search` method with a SQL-like [Google Ads Query\nLanguage](/google-ads/api/docs/query/overview).\n\nThe [Common methods](/google-ads/api/rest/common/overview) page goes into detail on\nthe most frequently used methods in the Google Ads API."]]