Caution: You are viewing documentation for the API's REST interface. Most of our official client libraries use gRPC. See the
REST Introduction for details.
服务方法
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Google Ads API 的设计不同于传统的 REST 架构,因为它主要使用自定义方法(例如 search
和 mutate,
),而不是更传统的 list
、get
、create
、update
和 delete
方法。这些操作通过 REST 网址表示,使用 HTTP 映射惯例,即使用 :
将自定义动词与网址的其余部分分开。
例如,广告系列 mutate 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 中最常用的方法。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-27。
[null,null,["最后更新时间 (UTC):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."]]