Search Ads 360 Reporting API เวอร์ชันใหม่พร้อมให้ใช้งานแล้ว เข้าร่วมกลุ่ม Google
searchads-api-announcements เพื่อติดตามการปรับปรุงและรุ่นที่กำลังจะเปิดตัว
การแมป JSON
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เมื่อใช้ REST อินเทอร์เฟซของ Search Ads 360 Reporting API คุณจะทำงานกับตัวแทน JSON
ของแหล่งข้อมูลและประเภทเดียวกันที่กำหนดไว้ใน
ไฟล์ตัวอธิบาย .proto ของ Search Ads 360 Reporting API รูปแบบการเข้ารหัส JSON เป็นไปตามรูปแบบการเข้ารหัสที่ชัดเจนซึ่งอธิบายไว้ในส่วนการแมป JSON ของคำแนะนำเกี่ยวกับภาษาของ Protocol Buffer
โดยทั่วไป ข้อความระดับบนสุดทั้งหมดที่ส่งไปยังและจากบริการจะเป็นออบเจ็กต์ JSON เดียว คำตอบ search
คือออบเจ็กต์ JSON ที่มีอาร์เรย์ results
พร้อมชุดผลลัพธ์ของคำค้นหา
ตัวระบุจะเปลี่ยนจาก snake_case (ในบัฟเฟอร์โปรโตคอล) เป็น
lowerCamelCase ใน JSON ข้อควรระวังที่สำคัญอย่างหนึ่งของกฎนี้คือเมื่อใช้
search
หรือ searchStream
เพื่อส่งคําค้นหา Search Ads 360 Query Language ภาษาของคําค้นหาเองจะใช้รูปแบบ Snake Case ไม่ว่าคุณจะใช้อินเทอร์เฟซใดก็ตาม
อย่างไรก็ตาม ผลลัพธ์ของการค้นหาใน REST จะแสดงเป็น
ออบเจ็กต์ JSON ปกติและมีตัวระบุในรูปแบบ lowerCamelCase
เช่น คำค้นหาเพื่อดึงรายการคีย์เวิร์ดที่ใช้งานอยู่ในบัญชีจะใช้
รูปแบบตัวพิมพ์เล็กคั่นด้วยขีดล่างภายในคำค้นหาเอง (ad_group_criterion
ไม่ใช่ adGroupCriterion
)
POST /v0/customers/CUSTOMER_ID/searchAds360:searchStream HTTP/1.1
Host: searchads360.googleapis.com
Content-Type: application/json
Authorization: Bearer ACCESS_TOKEN
{
"query": "SELECT ad_group_criterion.keyword.text
FROM ad_group_criterion
WHERE ad_group_criterion.type = 'KEYWORD'
AND ad_group_criterion.status = 'ENABLED'"
}
อย่างไรก็ตาม การตอบกลับคือการแสดงออบเจ็กต์ในรูปแบบ JSON (อยู่ในอาร์เรย์ JSON เนื่องจากคำขอนี้ใช้ searchStream
) และใช้ตัวระบุ camelCase
adGroupCriterion
แทน
[
{
"results": [
{
"adGroupCriterion": {
"resourceName": "customers/1842689525/adGroupCriteria/55771861891~10003060",
"keyword": {
"text": "pay per click"
}
}
},
...
]
}
]
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[[["\u003cp\u003eThe Search Ads 360 Reporting API's REST interface uses JSON to represent the resources and types defined in its .proto descriptor files, adhering to the canonical JSON encoding scheme.\u003c/p\u003e\n"],["\u003cp\u003eTop-level messages in REST are single JSON objects, and search responses contain a \u003ccode\u003eresults\u003c/code\u003e array holding the query's result set.\u003c/p\u003e\n"],["\u003cp\u003eIdentifiers are generally transformed from snake_case in protocol buffers to lowerCamelCase in JSON, except within Search Ads 360 Query Language queries which retain snake_case.\u003c/p\u003e\n"],["\u003cp\u003eAlthough Search Ads 360 Query Language uses snake_case, the results returned via REST are standard JSON objects with lowerCamelCase identifiers.\u003c/p\u003e\n"]]],["The Search Ads 360 Reporting API's REST interface uses JSON, mirroring the structure of its .proto descriptor files. Data is exchanged as JSON objects, with `search` responses containing a `results` array. Identifiers convert from *snake_case* in protocol buffers to *lowerCamelCase* in JSON, except within the Search Ads 360 Query Language, which remains *snake_case*. Query results, however, are returned in *lowerCamelCase* format. For instance, a query uses `ad_group_criterion` while the response will be `adGroupCriterion`.\n"],null,["# JSON Mappings\n\nWhen using the Search Ads 360 Reporting API's REST interface, you're working with JSON\nrepresentations of the same resources and types defined in the Search Ads 360 Reporting API's\n[.proto descriptor](https://github.com/googleapis/googleapis/tree/13301267d983903e0eb8e3713cf6d3127ea0ca47/google/ads/searchads360/v0/) files. The JSON encoding scheme follows the\ncanonical encoding scheme described in the\n[JSON Mapping](/protocol-buffers/docs/proto3#json) section of the protocol\nbuffers *Language Guide*.\n\nIn general, all top-level messages to and from\n[services](https://github.com/googleapis/googleapis/tree/13301267d983903e0eb8e3713cf6d3127ea0ca47/google/ads/searchads360/v0/services) are single JSON objects. `search` responses are JSON objects containing a `results` array with your query's result set.\n\nIdentifiers are transformed from *snake_case* (in protocol buffers) to\n*lowerCamelCase* in JSON. One notable caveat to this rule is when using\n`search` or `searchStream` to send [Search Ads 360 Query Language](/search-ads/reporting/query/query-language) queries. The query language itself uses snake case, regardless of which\ninterface you're using. However, the results of a query in REST are returned as\nnormal JSON objects and have their identifiers in lowerCamelCase.\n\nFor example, a query to fetch a list of active keywords in an account uses\nsnake case inside the query itself (`ad_group_criterion`, not `adGroupCriterion`): \n\n```http\nPOST /v0/customers/\u003cvar translate=\"no\"\u003eCUSTOMER_ID\u003c/var\u003e/searchAds360:searchStream HTTP/1.1\nHost: searchads360.googleapis.com\nContent-Type: application/json\nAuthorization: Bearer \u003cvar translate=\"no\"\u003eACCESS_TOKEN\u003c/var\u003e\n\n{\n \"query\": \"SELECT ad_group_criterion.keyword.text\n FROM ad_group_criterion\n WHERE ad_group_criterion.type = 'KEYWORD'\n AND ad_group_criterion.status = 'ENABLED'\"\n}\n```\n\nHowever, the response is a JSON representation of the objects (wrapped in a JSON\narray since this request uses `searchStream`) and uses the camelCase identifier\n`adGroupCriterion` instead: \n\n```javascript\n[\n {\n \"results\": [\n {\n \"adGroupCriterion\": {\n \"resourceName\": \"customers/1842689525/adGroupCriteria/55771861891~10003060\",\n \"keyword\": {\n \"text\": \"pay per click\"\n }\n }\n },\n ...\n ]\n }\n]\n```"]]