其他方法

虽然 MutateSearchSearchStream 是 Google Ads API 中最常用的方法,但还有许多其他方法用于特定目的。REST 参考文档中介绍了所有服务及其 API。

协议缓冲区 RPC 到 REST 的映射

所有服务端点(无论是使用 REST 还是 gRPC)最终都使用 proto3 接口定义语言服务软件包的 .proto 文件中定义。

示例:ListAccessibleCustomers

例如,除了标准 Mutate 之外,customer_service.proto 文件还定义了 ListAccessibleCustomers 方法。其 google.api.http 注释描述了该方法如何映射到 HTTP。它使用带有自定义动词 listAccessibleCustomers 的 HTTP GET

rpc ListAccessibleCustomers(ListAccessibleCustomersRequest)
    returns (ListAccessibleCustomersResponse) {
  option (google.api.http) = {
    get: "/v16/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: "/v16/customers/{customer_id=*}:createCustomerClient"
    body: "*"
  };
  option (google.api.method_signature) = "customer_id,customer_client";
}

这将映射到 customers.createCustomerClient REST 方法。