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