בדיקת משאב המוצרים
הנה כמה דוגמאות שבהן אפשר להשתמש כדי לבדוק את ההטמעה באמצעות
משאב products
.
הוספת מוצר
בונים JSON תקין של
המוצר.
ליצירת insert
בקשה
בנתוני המוצר ובמספר המזהה שלכם ב-Merchant Center:
POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
ודאו שקיבלתם קוד סטטוס HTTP 200
.
צפייה במוצר
ליצירת get
בקשה
ולציין את מספר המזהה שלכם ב-Merchant Center
productId:
GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
מוודאים שקיבלתם קוד סטטוס HTTP 200
ואת נתוני ה-JSON של
המוצר.
עדכון מוצר
בונים את קובץ ה-JSON החדש של מוצר מסוים. לדוגמה, שינוי שדה אחד
availability: in stock
של JSON, כדי availability: out of stock
בשביל
המוצר שבו השתמשת כדי לבדוק את הקריאה insert
.
ליצירת insert
בקשה
בנתוני המוצר החדשים ובמספר חשבון Merchant שלכם:
POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
ודאו שקיבלתם קוד סטטוס HTTP 200
. אחרי חמש לפחות
דקות, אפשר לשלוח עוד בקשת get
כדי לאשר את הערך המעודכן,
availability: out of stock
, הוחל.
מחיקת מוצר
ליצירת delete
בקשה
ולציין את מספר המזהה שלכם ב-Merchant Center
productId
:
DELETE https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
ודאו שקיבלתם קוד סטטוס HTTP 204
.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-08-22 (שעון UTC).
[null,null,["עדכון אחרון: 2024-08-22 (שעון UTC)."],[[["This page provides examples of how to interact with the `products` resource using the Content API for Shopping."],["You can add a new product by constructing valid JSON and making an `insert` request."],["View an existing product using a `get` request with your merchant ID and the product ID."],["Update a product's information by making an `insert` request with the updated JSON data."],["Delete a product using a `delete` request with your merchant ID and the product ID."]]],["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"]]