ข้อควรระวัง: คุณกําลังดูเอกสารประกอบสําหรับอินเทอร์เฟซ REST ของ API ไลบรารีของไคลเอ็นต์อย่างเป็นทางการส่วนใหญ่ของเราใช้ gRPC โปรดดูรายละเอียดใน
บทนํา REST
วิธีการของบริการ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การออกแบบ Google Ads API แตกต่างจากสถาปัตยกรรม REST แบบเดิม
เนื่องจากใช้เมธอดที่กำหนดเองเป็นหลัก เช่น search
และ mutate,
แทน
เมธอด list
, get
, create
, update
และ delete
แบบเดิม
การดำเนินการเหล่านี้แสดงใน URL ของ REST โดยใช้รูปแบบการแมป HTTP
ของ :
เพื่อแยกคำกริยาที่กำหนดเองออกจากส่วนที่เหลือของ URL
ตัวอย่างเช่น การเรียก API ของการเปลี่ยนแปลงแคมเปญจะใช้ URL ต่อไปนี้
https://googleads.googleapis.com/v21/customers/1234567890/campaigns:mutate
เหตุผลหนึ่งที่ API ใช้เมธอดที่กำหนดเองก็คือเพื่อเปิดใช้การจัดกลุ่มการดำเนินการหลายรายการ
ไว้ในคำขอ API เดียว ความหมายของ REST ที่เข้มงวดจะอนุญาตให้
อัปเดตแคมเปญได้ครั้งละ 1 รายการเท่านั้น REST แบบเดิม
update
ไปยัง
แคมเปญ เช่น จะต้องส่งคำขอ HTTP PATCH 1 รายการต่อแหล่งข้อมูลแคมเปญ
Google Ads API จึงกำหนดmutate
เมธอดที่กำหนดเองสำหรับทรัพยากรส่วนใหญ่แทน เพื่อให้รวมการดำเนินการหลายอย่างไว้ในส่วนเนื้อหาของคำขอเดียวได้
ในทำนองเดียวกัน หากต้องการเปิดใช้การอ่านแบบเป็นกลุ่ม (ดึงข้อมูลออบเจ็กต์หลายรายการพร้อมกัน) จาก API
API จะใช้search
เมธอดที่กำหนดเองพร้อมภาษาการค้นหาของ Google Ads ที่คล้ายกับ SQL
หน้าวิธีการทั่วไปจะอธิบายรายละเอียดเกี่ยวกับวิธีการที่ใช้บ่อยที่สุดใน Google Ads API
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-27 UTC
[null,null,["อัปเดตล่าสุด 2025-08-27 UTC"],[[["\u003cp\u003eThe Google Ads API utilizes custom methods like \u003ccode\u003esearch\u003c/code\u003e and \u003ccode\u003emutate\u003c/code\u003e instead of standard REST methods for efficiency and batch operations.\u003c/p\u003e\n"],["\u003cp\u003eThis approach allows for updating multiple campaigns or fetching numerous objects within a single request, unlike traditional REST.\u003c/p\u003e\n"],["\u003cp\u003eCustom methods are expressed in REST URLs using a colon to separate the verb from the rest of the URL, for example, \u003ccode\u003ehttps://googleads.googleapis.com/v18/customers/1234567890/campaigns:mutate\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eBatching operations, like updating many campaigns simultaneously, are enabled through the custom \u003ccode\u003emutate\u003c/code\u003e method, improving efficiency over individual requests.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esearch\u003c/code\u003e method uses a SQL-like query language for batch reads, enabling retrieval of multiple objects in one API call.\u003c/p\u003e\n"]]],["The Google Ads API uses custom methods like `search` and `mutate` instead of standard REST methods (e.g., `list`, `get`). This is indicated in URLs by a `:` separator. `Mutate` enables batching multiple operations into one request, unlike standard `update`, which handles one campaign at a time. Similarly, `search` allows fetching multiple objects in a single request, utilizing a SQL-like query language. This deviates from REST conventions to facilitate efficient batch processing and querying.\n"],null,["# Service Methods\n\nThe design of the Google Ads API differs from a traditional REST architecture\nbecause it primarily uses custom methods, such as `search` and `mutate,` instead\nof the more traditional `list`, `get`, `create`, `update`, and `delete` methods.\nThese actions are expressed in REST URLs by using the [HTTP mapping](https://cloud.google.com/apis/design/custom_methods#http_mapping)\nconvention of a `:` to separate the custom verb from the rest of the URL.\n\nFor example, a campaign mutate API call uses the following URL: \n\n https://googleads.googleapis.com/v21/customers/1234567890/campaigns:mutate\n\nOne reason that the API uses custom methods is to enable batching of multiple\noperations into a single API request. Strict REST semantics would only allow\nupdating one campaign at a time. A traditional REST\n[`update`](https://cloud.google.com/apis/design/standard_methods#update) to a\ncampaign, for example, would require sending one HTTP PATCH request per campaign\nresource.\n\nTo allow many operations to be bundled together within a single request body,\nthe Google Ads API instead defines a custom `mutate` method for most resources.\nSimilarly, to enable batch reads (fetching many objects at once) from the API,\nthe API uses a custom `search` method with a SQL-like [Google Ads Query\nLanguage](/google-ads/api/docs/query/overview).\n\nThe [Common methods](/google-ads/api/rest/common/overview) page goes into detail on\nthe most frequently used methods in the Google Ads API."]]