rocket
ขอแนะนำ
Merchant API
ซึ่งเป็นเวอร์ชันต่อไปอย่างเป็นทางการของ Content API for Shopping
update
รับข้อมูลล่าสุด
เกี่ยวกับฟีเจอร์ใหม่ การแก้ไขข้อบกพร่อง และการอัปเดตของ Merchant API
add_alert
หมายเหตุ: Content API for Shopping จะหยุดให้บริการในวันที่ 18 สิงหาคม 2026
การทดสอบทรัพยากรผลิตภัณฑ์
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ตัวอย่างที่คุณใช้เพื่อทดสอบการใช้งานกับ
ทรัพยากร products
รายการ
เพิ่มผลิตภัณฑ์
สร้าง JSON ที่ถูกต้องสำหรับ
ผลิตภัณฑ์
สร้าง insert
คำขอ
พร้อมข้อมูลผลิตภัณฑ์และรหัสผู้ขาย ดังนี้
POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
ยืนยันว่าคุณได้รับรหัสสถานะ HTTP 200
ดูผลิตภัณฑ์
สร้าง get
คำขอ
พร้อมกับรหัสผู้ขายของคุณ และ
productId:
GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
ยืนยันว่าคุณได้รับรหัสสถานะ HTTP 200
และข้อมูล JSON สำหรับ
ผลิตภัณฑ์
อัปเดตผลิตภัณฑ์
สร้าง JSON ใหม่สำหรับผลิตภัณฑ์ ตัวอย่างเช่น เปลี่ยนช่องเดียวใน
JSON availability: in stock
เป็น availability: out of stock
สำหรับ
ผลิตภัณฑ์ที่คุณใช้ทดสอบการเรียก insert
สร้าง insert
คำขอ
โดยระบุข้อมูลผลิตภัณฑ์ใหม่และรหัสผู้ขาย ดังนี้
POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
ยืนยันว่าคุณได้รับรหัสสถานะ HTTP 200
อย่างน้อย 5 ครั้ง
นาที คุณสามารถส่งคำขอ get
อีกครั้งเพื่อยืนยันค่าที่อัปเดตแล้ว
ใช้ availability: out of stock
แล้ว
ลบผลิตภัณฑ์
สร้าง delete
คำขอ
พร้อมกับรหัสผู้ขายของคุณ และ
productId
:
DELETE https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
ยืนยันว่าคุณได้รับรหัสสถานะ HTTP 204
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThis page provides examples of how to interact with the \u003ccode\u003eproducts\u003c/code\u003e resource using the Content API for Shopping.\u003c/p\u003e\n"],["\u003cp\u003eYou can add a new product by constructing valid JSON and making an \u003ccode\u003einsert\u003c/code\u003e request.\u003c/p\u003e\n"],["\u003cp\u003eView an existing product using a \u003ccode\u003eget\u003c/code\u003e request with your merchant ID and the product ID.\u003c/p\u003e\n"],["\u003cp\u003eUpdate a product's information by making an \u003ccode\u003einsert\u003c/code\u003e request with the updated JSON data.\u003c/p\u003e\n"],["\u003cp\u003eDelete a product using a \u003ccode\u003edelete\u003c/code\u003e request with your merchant ID and the product ID.\u003c/p\u003e\n"]]],["To add a product, create valid JSON for it, then send an `insert` request via POST with the data and merchant ID, expecting an `HTTP 200` response. To view, send a `get` request via GET with the merchant ID and product ID, confirming an `HTTP 200` status and the JSON. To update, create new JSON, make an `insert` POST request, and verify `HTTP 200` then check with `get`. To delete, send a `delete` request via DELETE with the ID, verifying an `HTTP 204` status.\n"],null,["# Testing the products resource\n\nHere are some examples you can use to test your implementation with the\n`products` resource.\n\nAdd a product\n-------------\n\n1. Construct [valid JSON for a\n product](/shopping-content/reference/rest/v2.1/products#resource:-product).\n\n2. Make an [`insert`\n request](/shopping-content/reference/rest/v2.1/products/insert#http-request)\n with the product data and your merchant ID:\n\n POST https://shoppingcontent.googleapis.com/content/v2.1/\u003cvar translate=\"no\"\u003emerchantId\u003c/var\u003e/products\n\n3. Verify that you receive an `HTTP 200` status code.\n\nView a product\n--------------\n\n1. Make a [`get`\n request](/shopping-content/reference/rest/v2.1/products/get#http-request)\n with your merchant ID, and the product's\n [productId](/shopping-content/guides/products/product-id):\n\n GET https://shoppingcontent.googleapis.com/content/v2.1/\u003cvar translate=\"no\"\u003emerchantId\u003c/var\u003e/products/\u003cvar translate=\"no\"\u003eproductId\u003c/var\u003e\n\n2. Verify that you receive an `HTTP 200` status code, and the JSON data for the\n product.\n\nUpdate a product\n----------------\n\n1. Construct the new JSON for a product. For example, change a single field in\n the JSON `availability: in stock`, to `availability: out of stock` for the\n product you used to test the `insert` call.\n\n2. Make an [`insert`\n request](/shopping-content/reference/rest/v2.1/products/insert#http-request)\n with the new product data and your merchant ID:\n\n POST https://shoppingcontent.googleapis.com/content/v2.1/\u003cvar translate=\"no\"\u003emerchantId\u003c/var\u003e/products\n\n3. Verify that you receive an `HTTP 200` status code. After at least five\n minutes, you can make another `get` request to confirm the updated value,\n `availability: out of stock`, was applied.\n\nDelete a product\n----------------\n\n1. Make a [`delete`\n request](/shopping-content/reference/rest/v2.1/products/delete#http-request)\n with your merchant ID, and the product's\n [`productId`](/shopping-content/guides/products/product-id):\n\n DELETE https://shoppingcontent.googleapis.com/content/v2.1/\u003cvar translate=\"no\"\u003emerchantId\u003c/var\u003e/products/\u003cvar translate=\"no\"\u003eproductId\u003c/var\u003e\n\n2. Verify that you receive an `HTTP 204` status code."]]