雖然 Mutate
、Search
和 SearchStream
是 Google Ads API 中最常見的方法,但還有許多其他方法可用於特定用途。所有服務和 API 都記錄在參考資料文件中。
通訊協定緩衝區 RPC 對應至 REST
所有服務端點 (無論是使用 REST 或 gRPC) 最終都會使用 proto3 介面定義語言,在服務套件的 .proto 檔案中定義。
範例:ListAccessibleCustomers
舉例來說,customer_service.proto
檔案除了標準的 Mutate
之外,還定義了 ListAccessibleCustomers
方法。其 google.api.http
註解說明方法如何對應至 HTTP。它會使用 HTTP GET
,並搭配自訂動詞 listAccessibleCustomers
:
rpc ListAccessibleCustomers(ListAccessibleCustomersRequest) returns (ListAccessibleCustomersResponse) { option (google.api.http) = { get: "/v21/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: "/v21/customers/{customer_id=*}:createCustomerClient" body: "*" }; option (google.api.method_signature) = "customer_id,customer_client"; }
這會對應至 customers.createCustomerClient REST 方法。