其他方法

虽然 Mutate、Search 和 SearchStream 是 Google Ads API 中最常用的方法 ,但还有许多其他方法可用于特定用途。所有服务及其 API 都在 参考文档中进行了说明。

协议缓冲区 RPC 到 REST 的映射

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

示例:ListAccessibleCustomers

例如,customer_service.proto 文件 定义了 ListAccessibleCustomers 方法,以及标准 Mutate 。其 google.api.http 注解描述了 该方法如何映射到 HTTP。它使用 HTTP GET 和自定义动词 listAccessibleCustomers:

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

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