Testing the products resource

  • 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.

Here are some examples you can use to test your implementation with the products resource.

Add a product

  1. Construct valid JSON for a product.

  2. Make an insert request with the product data and your merchant ID:

    POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
    
  3. Verify that you receive an HTTP 200 status code.

View a product

  1. Make a get request with your merchant ID, and the product's productId:

    GET https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
    
  2. Verify that you receive an HTTP 200 status code, and the JSON data for the product.

Update a product

  1. Construct the new JSON for a product. For example, change a single field in the JSON availability: in stock, to availability: out of stock for the product you used to test the insert call.

  2. Make an insert request with the new product data and your merchant ID:

    POST https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products
    
  3. Verify that you receive an HTTP 200 status code. After at least five minutes, you can make another get request to confirm the updated value, availability: out of stock, was applied.

Delete a product

  1. Make a delete request with your merchant ID, and the product's productId:

    DELETE https://shoppingcontent.googleapis.com/content/v2.1/merchantId/products/productId
    
  2. Verify that you receive an HTTP 204 status code.