Mutate
, Search
i SearchStream
to najpopularniejsze metody w interfejsie Google Ads API, ale jest też wiele innych metod do konkretnych celów. Informacje o wszystkich usługach i ich interfejsach API znajdziesz w dokumentacji referencyjnej REST.
RPC bufora protokołu do mapowań REST
Wszystkie punkty końcowe usługi (niezależnie od tego, czy używają REST lub gRPC) są ostatecznie zdefiniowane w plikach.proto pakietu usług za pomocą języka definiowania interfejsu proto3.
Przykład: ListAccessibleCustomers
Na przykład plik customer_service.proto
definiuje metodę ListAccessibleCustomers
oprócz standardowej metody Mutate
. Adnotacja google.api.http
opisuje sposób mapowania metody na HTTP. Używa żądania HTTP GET
z niestandardowym czasownikiem listAccessibleCustomers
:
rpc ListAccessibleCustomers(ListAccessibleCustomersRequest) returns (ListAccessibleCustomersResponse) { option (google.api.http) = { get: "/v17/customers:listAccessibleCustomers" }; }
Jest to mapowane na metodę REST customers.listAccessibleCustomers.
Przykład: CreateCustomerClient
Innym przykładem z elementu customer_service.proto
jest metoda CreateCustomerClient
. Adnotacja google.api.http
opisuje link HTTP POST
z użyciem niestandardowego czasownika createCustomerClient
:
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"; }
Jest to mapowane na metodę REST customers.createCustomerClient.