注意:您正在查看 API 的 REST 介面說明文件。我們的官方用戶端程式庫支援 gRPC。詳情請參閱
REST 簡介。
服務方法
Google Ads API 的設計與傳統的 REST 架構不同
因為容器主要使用 search
和 mutate,
等自訂方法
較傳統的 list
、get
、create
、update
和 delete
方法。
這些動作會以 REST 網址表示,方法是利用 HTTP 對應
:
的慣例,藉此區隔自訂動詞與網址的其他部分。
舉例來說,廣告活動的 變更 API 呼叫會使用下列網址:
https://googleads.googleapis.com/v17/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 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-22 (世界標準時間)。
[null,null,["上次更新時間:2024-08-22 (世界標準時間)。"],[[["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"]]