Các phương pháp khác

Mặc dù Mutate, SearchSearchStream là các phương thức phổ biến nhất trong API Google Ads, nhưng còn có nhiều phương thức khác dành cho các mục đích cụ thể. Tất cả các dịch vụ và API của các dịch vụ đó đều được ghi lại trong tài liệu tham khảo REST.

Ánh xạ RPC vùng đệm giao thức sang REST

Cuối cùng, tất cả các điểm cuối dịch vụ (cho dù sử dụng REST và gRPC) đều được xác định trong các tệp.proto của gói dịch vụ bằng Ngôn ngữ định nghĩa giao diện proto3.

Ví dụ: ListAccessibleCustomer

Ví dụ: tệp customer_service.proto xác định phương thức ListAccessibleCustomers, ngoài Mutate chuẩn. Chú giải google.api.http mô tả cách phương thức này ánh xạ tới HTTP. Phương thức này sử dụng GET HTTP với động từ tuỳ chỉnh listAccessibleCustomers:

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

Thao tác này liên kết với phương thức REST customers.listAccessibleCustomers.

Ví dụ: CreateCustomerClient

Một ví dụ khác từ customer_service.proto là phương thức CreateCustomerClient. Chú giải google.api.http của nó mô tả một HTTP POST bằng cách sử dụng động từ tuỳ chỉnh createCustomerClient:

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

Thao tác này sẽ liên kết với phương thức REST customers.createCustomerClient.