Inne metody

Mutate, SearchSearchStream to najpopularniejsze metody w interfejsie Google Ads API, ale istnieje wiele innych metod do określonych celów. Wszystkie usługi i ich interfejsy API są opisane w dokumentacji referencyjnej REST.

Mapowania RPC bufora protokołu na REST

Wszystkie punkty końcowe usług (zarówno korzystające z REST, jak i gRPC) są ostatecznie zdefiniowane w plikach.proto pakietu usług za pomocą języka definicji interfejsu proto3.

Przykład: ListAccessibleCustomers

Na przykład 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 on żądania HTTP GET z niestandardowym czasownikiem listAccessibleCustomers:

rpc ListAccessibleCustomers(ListAccessibleCustomersRequest)
    returns (ListAccessibleCustomersResponse) {
  option (google.api.http) = {
    get: "/v20/customers:listAccessibleCustomers"
  };
}

Odpowiada to metodzie REST customers.listAccessibleCustomers.

Przykład: CreateCustomerClient

Innym przykładem z customer_service.proto jest metoda CreateCustomerClient. Jego adnotacja google.api.http opisuje protokół HTTP POST przy użyciu niestandardowego czasownika createCustomerClient:

rpc CreateCustomerClient(CreateCustomerClientRequest)
    returns (CreateCustomerClientResponse) {
  option (google.api.http) = {
    post: "/v20/customers/{customer_id=*}:createCustomerClient"
    body: "*"
  };
  option (google.api.method_signature) = "customer_id,customer_client";
}

Odpowiada to metodzie REST customers.createCustomerClient.