注意:您正在查看 API 的 REST 介面說明文件。我們的官方用戶端程式庫支援 gRPC。詳情請參閱
REST 簡介。
其他方法
雖然 Mutate
、Search
和 SearchStream
是 Google Ads API 中最常見的方法,但還有許多其他方法可用於特定用途。所有服務及其 API 皆記載於 REST 參考資料說明文件中。
Protocol Buffer RPC 到 REST 對應
所有服務端點 (無論是使用 REST 和 gRPC) 最終都會在服務套件 .proto 檔案中使用 proto3 介面定義語言定義。
範例: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 方法。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-03-01 (世界標準時間)。
[null,null,["上次更新時間: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"]]