Uwaga: przeglądasz dokumentację interfejsu REST interfejsu API. Większość oficjalnych bibliotek klienta używa gRPC. Więcej informacji znajdziesz we
wprowadzeniu do REST.
Inne metody
Chociaż metody Mutate
, Search
i SearchStream
są najpopularniejszymi metodami w interfejsie Google Ads API, do określonych celów można też używać wielu innych metod. Wszystkie usługi i ich interfejsy API są opisane w dokumentacji referencyjnej REST.
Mapowania RPC Protocol Buffer na REST
Wszystkie punkty końcowe usługi (czy to za pomocą REST, czy gRPC) są ostatecznie zdefiniowane w plikach.proto pakietu usług za pomocą języka definicji interfejsu proto3.
Przykład: ListAccessibleCustomers
Przykładowo plik customer_service.proto
definiuje metodę ListAccessibleCustomers
oprócz standardowej metody Mutate
. Jego adnotacja google.api.http
opisuje, jak metoda jest mapowana na HTTP. Używa ona HTTP GET
z niestandardowym czasownikiem listAccessibleCustomers
:
rpc ListAccessibleCustomers(ListAccessibleCustomersRequest)
returns (ListAccessibleCustomersResponse) {
option (google.api.http) = {
get: "/v19/customers:listAccessibleCustomers"
};
}
Odpowiada ona metodzie REST customers.listAccessibleCustomers.
Przykład: CreateCustomerClient
Innym przykładem z customer_service.proto
jest metoda CreateCustomerClient
. Jego adnotacja google.api.http
opisuje HTTP POST
za pomocą niestandardowego czasownika createCustomerClient
:
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";
}
Odpowiada ona metodzie REST customers.createCustomerClient.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-02-27 UTC.
[null,null,["Ostatnia aktualizacja: 2025-02-27 UTC."],[[["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"]]