احتیاط: شما در حال مشاهده اسناد رابط REST API هستید. اکثر کتابخانه های مشتری رسمی ما از gRPC استفاده می کنند. برای جزئیات بیشتر به
مقدمه REST مراجعه کنید.
سایر روش ها
در حالی که Mutate
، Search
، و SearchStream
رایجترین روشها در Google Ads API هستند، روشهای بسیار دیگری برای اهداف خاص وجود دارد. همه سرویس ها و API های آنها در مستندات مرجع REST مستند شده است.
پروتکل بافر RPC به REST نگاشت
تمام نقاط پایانی سرویس (اعم از استفاده از REST و gRPC) در نهایت در فایلهای .proto بسته خدمات با استفاده از زبان تعریف رابط proto3 تعریف میشوند.
مثال: ListAccessibleCustomers
به عنوان مثال، فایل customer_service.proto
علاوه بر Mutate
استاندارد، یک متد ListAccessibleCustomers
را تعریف می کند. حاشیه نویسی google.api.http
آن توضیح می دهد که چگونه روش به HTTP نگاشت می شود. از HTTP GET
با فعل سفارشی listAccessibleCustomers
استفاده می کند:
rpc ListAccessibleCustomers(ListAccessibleCustomersRequest)
returns (ListAccessibleCustomersResponse) {
option (google.api.http) = {
get: "/v19/customers:listAccessibleCustomers"
};
}
این به روش customers.listAccessibleCustomers REST نگاشت می شود.
مثال: CreateCustomerClient
مثال دیگری از customer_service.proto
متد CreateCustomerClient
است. حاشیه نویسی google.api.http
آن یک HTTP POST
با استفاده از فعل سفارشی 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";
}
این به روش customers.createCustomerClient REST نگاشت می شود.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-03-08 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-03-08 بهوقت ساعت هماهنگ جهانی."],[[["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"]]