These test examples use base_url
to refer to https://www.googleapis.com
.
In addition, all examples use /content/v2.1
in the URL in a
production environment. In this example we add, view, update and delete a
product.
Add a product
Construct valid JSON for a product (or use the one in the
products.insert
section above).Perform an
INSERT
to the API endpoint as:INSERT https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
Use your own merchant ID and the product JSON.
You should receive an
HTTP 200
status code for success and your original JSON.
View a product
Perform a
GET
to the API endpoint as:GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
Use your own merchant ID and the product ID (Rest ID). To get the product that was inserted in the previous step, use the product ID
online:en:US:1111111111
.You should receive an
HTTP 200
status code for success and the JSON for the product ID submitted.
Update a product
Construct valid JSON for a product (modify the one in the
products.insert
section above). Use your own merchant ID. For example, you can change a single field in the JSONavailability: in stock
, toout of stock
for the product IDonline:en:US:1111111111
in theproduct.insert
section above.Perform an
INSERT
to the API endpoint as:INSERT https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
You should receive an
HTTP 200
status code for success, and the JSON for the product ID submitted, with an updated value ofavailability: out of stock
.
Delete a product
Use your own merchant ID and product ID (Rest ID), for example:
online:en:US:111111111
.Perform a
DELETE
to the API endpoint as:DELETE https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
You should receive an
HTTP 204
status code for a successful API call.