We will sunset v2 of the Content API on March 29th, 2021. To avoid disruptions with your integration, please migrate to v2.1 as soon as possible. For more information, see Migrating to v2.1.

Using supplemental feeds with the Content API

You can use supplemental feeds to make partial updates to product data by adding the feedId as a query parameter when making calls to the Products.insert, Products.delete, Products.custombatch.insert, and Products.custombatch.delete methods.

For example, you can make a Products.insert supplemental feed method call to the following URL:

POST https://www.googleapis.com/content/v2.1/merchantId/products?feedId=feedId

Products.insert

The supplemental feed Products.insert method adds the product fields you send in the request body, overwriting those fields if they exist. When using a supplemental feed, this method leaves all other product fields unchanged, unless the fields had been included in a previous request for the same feed. While data added via other feeds is not affected, each request overwrites the previous requests for the same feed. This means that if you add or update a field via a supplemental feed request, and then do not include the field in a subsequent request, the data for the omitted field is removed from the feed. This behavior differs from calling Products.insert without a supplemental feed, which deletes all existing product data and replaces it with the fields you send in the request body.

Use the following URL to make a request to the supplemental feed Product.insert service:

POST https://www.googleapis.com/content/v2.1/merchantId/products?feedId=feedId

You must include the offerId, targetCountry, channel, and contentLanguage fields in the request body. All other fields are optional.

Example

To change the availability of a product from “in stock” to “out of stock”, you could use the following request body to make a supplemental feeds Product.insert method call:

{
 "offerId": "1111111111",
 "contentLanguage": "en",
 "targetCountry": "US",
 "channel": "online",
 "availability": "out of stock",
}

Products.delete

The Products.delete method removes all of the supplemental data that was previously added by Products.insert calls using the specified supplemental feed. Calling this method for a supplemental feed does not affect the original product data added before the supplemental feed Product.insert call(s) were made. You can think of this like removing a layer of data for a specific feed; the data added via other feeds is unaffected, and the product effectively reverts to its previous state before the supplemental feed layer was added. This differs from calling Products.delete without a supplemental feed, which deletes the entire product and all of its data.

Use the following URL to make a request the supplemental feed Products.delete service, where the productId is the REST ID of the product, represented as: channel:contentLanguage:targetCountry:offerId:

DELETE https://www.googleapis.com/content/v2.1/merchantId/products/productId?feedId=feedId

No request body is needed for supplemental feeds Products.delete method calls.

Products.custombatch

The custombatch methods allow you to insert or delete supplemental feed data for multiple products using a single API call to minimize the number of API calls made.

Use the following request URL to make a call to the custom batch APIs:

https://www.googleapis.com/content/v2.1/products/batch

For all supplemental feed custombatch calls, you must include the batchId, merchantID, method, and feedId parameters in the request body.

Products.custombatch:insert

When making supplemental feed calls to the Products.custombatch:insert method, you must include the offerId, targetCountry, channel, and contentLanguage in the request body, in addition to the required batchId, merchantID, and method parameters. All other product fields are optional.

Example

To update the price value for two existing products, you could use the following request to make a Products.custombatch:insert method call:.

{
  "entries": [
    {
      "batchId": 1111,
      "merchantId": 1234567,
      "method": "insert",
      "feedId": "7654321",
      "product": {
         "offerId": "1111111111",
         "contentLanguage": "en",
         "targetCountry": "US",
         "channel": "online",
         "price": {
          "value": "30.99",
          "currency": "USD"
         }
      }
    },
    {
      "batchId": 1112,
      "merchantId": 1234567,
      "method": "insert",
      "feedId": "7654321",
      "product": {
         "offerId": "2222222222",
         "contentLanguage": "en",
         "targetCountry": "US",
         "channel": "online",
         "price": {
          "value": "33.99",
          "currency": "USD"
         },
      },
    }
}

Products.custombatch:delete

To remove all updates made to two products via a specified supplemental feed, you could use the following request to make a Products.custombatch:delete method call:

{
  "entries": [
    {
      "batchId": 1115,
      "merchantId": 1234567,
      "method": "delete",
      "feedId": "7654321",
      "productId": "online:en:US:1111111111"
    },
    {
      "batchId": 1116,
      "merchantId": 1234567,
      "method": "delete",
      "feedId": "7654321",
      "productId": "online:en:US:2222222222"
    }
  ]
}