注意:您正在查看 API 的 REST 介面說明文件。我們的官方用戶端程式庫支援 gRPC。詳情請參閱
REST 簡介。
服務方法
Google Ads API 的設計與傳統 REST 架構不同,因為它主要使用自訂方法 (例如 search
和 mutate,
),而非傳統的 list
、get
、create
、update
和 delete
方法。這些動作會以 REST 網址表示,方法是使用 :
的 HTTP 對應慣例,將自訂動詞與網址的其餘部分區隔開來。
舉例來說,廣告活動變更 API 呼叫會使用下列網址:
https://googleads.googleapis.com/v19/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-03-04 (世界標準時間)。
[null,null,["上次更新時間:2025-03-04 (世界標準時間)。"],[[["The Google Ads API utilizes custom methods like `search` and `mutate` instead of standard REST methods for efficiency and batch operations."],["This approach allows for updating multiple campaigns or fetching numerous objects within a single request, unlike traditional REST."],["Custom methods are expressed in REST URLs using a colon to separate the verb from the rest of the URL, for example, `https://googleads.googleapis.com/v18/customers/1234567890/campaigns:mutate`."],["Batching operations, like updating many campaigns simultaneously, are enabled through the custom `mutate` method, improving efficiency over individual requests."],["The `search` method uses a SQL-like query language for batch reads, enabling retrieval of multiple objects in one API call."]]],["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"]]