ข้อควรระวัง: คุณกําลังดูเอกสารประกอบสําหรับอินเทอร์เฟซ REST ของ API ไลบรารีของไคลเอ็นต์อย่างเป็นทางการส่วนใหญ่ของเราใช้ gRPC โปรดดูรายละเอียดใน
บทนํา REST
วิธีการอื่นๆ
แม้ว่า Mutate
, Search
และ SearchStream
จะเป็นเมธอดที่ใช้กันมากที่สุดใน Google Ads API แต่ก็มีเมธอดอื่นๆ อีกมากมายสําหรับวัตถุประสงค์ที่เฉพาะเจาะจง บริการและ API ทั้งหมดมีอยู่ในเอกสารอ้างอิง REST
การแมป Protocol Buffer RPC กับ REST
ปลายทางบริการทั้งหมด (ไม่ว่าจะใช้ REST หรือ gRPC) จะได้รับการกําหนดในท้ายที่สุด
ใน
ไฟล์ .proto ของแพ็กเกจบริการ
โดยใช้ภาษาคําจํากัดความอินเทอร์เฟซ proto3
ตัวอย่าง: ListAccessibleCustomers
เช่น ไฟล์ customer_service.proto
จะกำหนดเมธอด ListAccessibleCustomers
นอกเหนือจาก Mutate
มาตรฐาน คําอธิบายประกอบ google.api.http
จะอธิบายวิธีแมปเมธอดกับ HTTP โดยใช้ HTTP GET
ที่มีคํากริยาที่กําหนดเอง listAccessibleCustomers
rpc ListAccessibleCustomers(ListAccessibleCustomersRequest)
returns (ListAccessibleCustomersResponse) {
option (google.api.http) = {
get: "/v19/customers:listAccessibleCustomers"
};
}
ซึ่งจะเชื่อมโยงกับเมธอด REST ของ customers.listAccessibleCustomers
ตัวอย่าง: 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
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-03-01 UTC
[null,null,["อัปเดตล่าสุด 2025-03-01 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"]]