注意:您正在查看 API 的 REST 接口的文档。我们的大多数官方客户端库都使用 gRPC。如需了解详情,请参阅
REST 简介。
服务方法
Google Ads API 的设计不同于传统的 REST 架构,因为它主要使用自定义方法(例如 search
和 mutate,
),而不是更传统的 list
、get
、create
、update
和 delete
方法。这些操作通过使用 :
的 HTTP 映射惯例在 REST 网址中表示,以将自定义动词与网址的其余部分分隔开来。
例如,广告系列更改 API 调用使用以下网址:
https://googleads.googleapis.com/v19/customers/1234567890/campaigns:mutate
该 API 使用自定义方法的一个原因是,能够将多个操作批量处理到单个 API 请求中。严格的 REST 语义仅允许一次更新一个广告系列。例如,对广告系列发出传统 REST update
时,需要为每个广告系列资源发送一个 HTTP PATCH 请求。
为了允许将许多操作捆绑在单个请求正文中,Google Ads API 改为为大多数资源定义了自定义 mutate
方法。同样,为了从 API 启用批量读取(一次提取多个对象),该 API 使用类似 SQL 的 Google Ads 查询语言与自定义 search
方法搭配使用。
常用方法页面详细介绍了 Google Ads API 中最常用的方法。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-26。
[null,null,["最后更新时间 (UTC):2025-02-26。"],[[["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"]]