AI-generated Key Takeaways
-
This page provides examples of how to interact with the
productsresource using the Content API for Shopping. -
You can add a new product by constructing valid JSON and making an
insertrequest. -
View an existing product using a
getrequest with your merchant ID and the product ID. -
Update a product's information by making an
insertrequest with the updated JSON data. -
Delete a product using a
deleterequest with your merchant ID and the product ID.
Here are some examples you can use to test your implementation with the
products resource.
Add a product
Construct valid JSON for a product.
Make an
insertrequest with the product data and your merchant ID:POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/productsVerify that you receive an
HTTP 200status code.
View a product
Make a
getrequest with your merchant ID, and the product's productId:GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productIdVerify that you receive an
HTTP 200status code, and the JSON data for the product.
Update a product
Construct the new JSON for a product. For example, change a single field in the JSON
availability: in stock, toavailability: out of stockfor the product you used to test theinsertcall.Make an
insertrequest with the new product data and your merchant ID:POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/productsVerify that you receive an
HTTP 200status code. After at least five minutes, you can make anothergetrequest to confirm the updated value,availability: out of stock, was applied.
Delete a product
Make a
deleterequest with your merchant ID, and the product'sproductId:DELETE https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productIdVerify that you receive an
HTTP 204status code.