注意:您正在查看 API 的 REST 接口的文档。我们的大多数官方客户端库都使用 gRPC。如需了解详情,请参阅
REST 简介。
其他方法
虽然 Mutate
、Search
和 SearchStream
是 Google Ads API 中最常见的方法,但还有许多其他方法可用于特定用途。所有服务及其 API 均在 REST 参考文档中进行了记录。
Protocol Buffer RPC 到 REST 映射
所有服务端点(无论是使用 REST 还是 gRPC)最终都是使用 proto3 接口定义语言在服务软件包的 .proto 文件中定义的。
示例:ListAccessibleCustomers
例如,除了标准的 Mutate
之外,customer_service.proto
文件还定义了 ListAccessibleCustomers
方法。其 google.api.http
注解描述了该方法如何映射到 HTTP。它使用 HTTP GET
和自定义动词 listAccessibleCustomers
:
rpc ListAccessibleCustomers(ListAccessibleCustomersRequest)
returns (ListAccessibleCustomersResponse) {
option (google.api.http) = {
get: "/v19/customers:listAccessibleCustomers"
};
}
这会映射到 customers.listAccessibleCustomers REST 方法。
示例:CreateCustomerClient
customer_service.proto
中的另一个示例是 CreateCustomerClient
方法。其 google.api.http
注解使用自定义动词 createCustomerClient
描述 HTTP POST
:
rpc CreateCustomerClient(CreateCustomerClientRequest)
returns (CreateCustomerClientResponse) {
option (google.api.http) = {
post: "/v19/customers/{customer_id=*}:createCustomerClient"
body: "*"
};
option (google.api.method_signature) = "customer_id,customer_client";
}
这会映射到 customers.createCustomerClient REST 方法。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-01。
[null,null,["最后更新时间 (UTC):2025-03-01。"],[[["While `Mutate`, `Search`, and `SearchStream` are commonly used, the Google Ads API offers a wide range of methods for specific tasks, all documented in the REST reference documentation."],["All Google Ads API service endpoints, including REST and gRPC, are defined in .proto files using the proto3 Interface Definition Language."],["The `google.api.http` annotation within these .proto files details how each method maps to HTTP for RESTful interactions, including examples like `ListAccessibleCustomers` and `CreateCustomerClient`."]]],["The Google Ads API includes various methods beyond `Mutate`, `Search`, and `SearchStream`, all detailed in REST documentation. Service endpoints are defined in `.proto` files using proto3. `ListAccessibleCustomers` is a GET method, mapped using the `google.api.http` annotation in the `customer_service.proto` file, and uses custom verb `listAccessibleCustomers`. Similarly, `CreateCustomerClient`, a POST method, uses custom verb `createCustomerClient`, also defined in the same file.\n"]]