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

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

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

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ụ: ListAccessibleCustomers

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

rpc ListAccessibleCustomers(ListAccessibleCustomersRequest)
    returns (ListAccessibleCustomersResponse) {
  option (google.api.http) = {
    get: "/v21/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 mô tả một POST HTTP bằng cách sử dụng động từ tuỳ chỉnh createCustomerClient:

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

Thao tác này tương ứng với phương thức REST customers.createCustomerClient.