Chú ý: Bạn đang xem tài liệu về giao diện REST của API. Hầu hết các thư viện ứng dụng chính thức của chúng tôi đều sử dụng gRPC. Hãy xem
Giới thiệu về REST để biết chi tiết.
Các phương pháp khác
Mặc dù Mutate
, Search
và SearchStream
là các phương thức phổ biến nhất trong API Google Ads, nhưng vẫn còn nhiều phương thức khác cho các mục đích cụ thể. Tất cả dịch vụ và API của chúng được ghi lại trong tài liệu tham khảo về REST.
Liên kết RPC vùng đệm giao thức với REST
Tất cả các điểm cuối dịch vụ (dù sử dụng REST và gRPC) đều được xác định cuối cùng 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
tiêu chuẩn. Chú thích google.api.http
mô tả cách phương thức liên kết vớ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: "/v19/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ả 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: "/v19/customers/{customer_id=*}:createCustomerClient"
body: "*"
};
option (google.api.method_signature) = "customer_id,customer_client";
}
Thao tác này liên kết với phương thức REST customers.createCustomerClient.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-02-27 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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"]]