แม้ว่า Mutate
, Search
และ SearchStream
จะเป็นวิธีที่พบบ่อยที่สุดใน Google Ads API แต่ก็ยังมีวิธีอื่นๆ อีกมากมายสำหรับวัตถุประสงค์เฉพาะ บริการทั้งหมดและ
API ของบริการเหล่านั้นมีอยู่ใน
เอกสารอ้างอิง
การแมป RPC แบบ Protocol Buffer กับ 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: "/v21/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: "/v21/customers/{customer_id=*}:createCustomerClient" body: "*" }; option (google.api.method_signature) = "customer_id,customer_client"; }
ซึ่งจะแมปกับเมธอด REST customers.createCustomerClient