You can use custombatch
to insert
, get
, or delete
multiple products at a
time in a single API call.
Use the following request URL to make a call to the custom batch APIs:
POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch
The request body contains specific parameters: batchId
, merchantID
,
and a method
.
Only use the productId
if you are executing a get or delete. The productId
is not required on an insert API call for custombatch
.
custombatch:insert
The following request URL is used to make a products.custombatch method=insert
POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch
To insert the two new products, specify the batchId
for each product, the
merchantId
of the merchant authorized to make the API call, and the method
insert
.
In the following example, the batchId
values are 1111
and 1112
respectively, and are unique identifiers for each product. The merchantId:
1234567
is the merchant that's authorized to make the API call, and the method
is get
, delete
, or insert
.
An insert
creates a new product. If values exist for the attributes
channel
, contentLanguage
, offerId
, and feedLabel
for a given
product, this method updates the entry and replaces all data from previous API
calls for the product.
Here's a sample JSON body to insert
two t-shirts into the Merchant Center
database using a single API call:
{
"entries": [
{
"batchId": 1111,
"merchantId": 1234567,
"method": "insert",
"product": {
"kind": "content#product",
"offerId": "1111111111",
"title": "Google Tee Black",
"description": "The Black Google Tee is available in unisex sizing and
features a retail fit.",
"link": "http://my.site.com/blacktee/",
"imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg",
"contentLanguage": "en",
"targetCountry": "US",
"feedLabel": "US",
"channel": "online",
"ageGroup": "adult",
"availability": "in stock",
"availabilityDate": "2019-01-25T13:00:00-08:00",
"brand": "Google",
"color": "black",
"condition": "new",
"gender": "male",
"googleProductCategory": "1604",
"gtin": "608802531656",
"itemGroupId": "google_tee",
"mpn": "608802531656",
"price": {
"value": "21.99",
"currency": "USD"
},
"sizes": [
"Large"
],
"includedDestination": [
"Shopping"
]
}
},
{
"batchId": 1112,
"merchantId": 1234567,
"method": "insert",
"product": {
"kind": "content#product",
"offerId": "2222222222",
"title": "Google Tee Green",
"description": "100% cotton jersey fabric sets this Google t-shirt above
the crowd. Features the google logo across the chest. Unisex sizing.",
"link": "http://my.site.com/greentee/",
"imageLink": "https://shop.example.com/.../images/GGOEGXXX0906.jpg",
"contentLanguage": "en",
"targetCountry": "US",
"feedLabel": "US",
"channel": "online",
"ageGroup": "adult",
"availability": "in stock",
"availabilityDate": "2019-01-25T13:00:00-08:00",
"brand": "Google",
"color": "green",
"condition": "new",
"gender": "male",
"googleProductCategory": "1604",
"gtin": "608802531649",
"itemGroupId": "google_tee",
"mpn": "608802531649",
"price": {
"value": "21.99",
"currency": "USD"
},
"sizes": [
"Medium"
],
"includedDestination": [
"Shopping"
]
}
}
]
}
A successful API call returns an HTTP 200
code and JSON response that
includes the products that were inserted. The format of the return JSON
is similar to the following:
{
"kind": "content#productsCustomBatchResponse",
"entries": [
{
"kind": "content#productsCustomBatchResponseEntry",
"batchId": 1111,
"product": {
"kind": "content#product",
"id": "online:en:US:1111111111",
"offerId": "1111111111",
"title": "Google Tee Black",
"description": "The Black Google Tee is available in unisex sizing and
features a retail fit.",
"link": "http://my.site.com/blacktee/",
"imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg",
"contentLanguage": "en",
"targetCountry": "US",
"feedLabel": "US",
"channel": "online",
"ageGroup": "adult",
"availability": "in stock",
"availabilityDate": "2019-01-25T13:00:00-08:00",
"brand": "Google",
"color": "black",
"condition": "new",
"gender": "male",
"googleProductCategory": "1604",
"gtin": "608802531656",
"itemGroupId": "google_tee",
"mpn": "608802531656",
"price": {
"value": "21.99",
"currency": "USD"
},
"sizes": [
"Large"
],
"includedDestination": [
"Shopping"
]
}
},
{
"kind": "content#productsCustomBatchResponseEntry",
"batchId": 1112,
"product": {
"kind": "content#product",
"id": "online:en:US:2222222222",
"offerId": "2222222222",
"title": "Google Tee Green",
"description": "100% cotton jersey fabric sets this Google t-shirt above
the crowd. Features the google logo across the chest. Unisex sizing.",
"link": "http://my.site.com/greentee/",
"imageLink": "https://shop.example.com/.../images/GGOEGXXX0906.jpg",
"contentLanguage": "en",
"targetCountry": "US",
"feedLabel": "US",
"channel": "online",
"ageGroup": "adult",
"availability": "in stock",
"availabilityDate": "2019-01-25T13:00:00-08:00",
"brand": "Google",
"color": "green",
"condition": "new",
"gender": "male",
"googleProductCategory": "1604",
"gtin": "608802531649",
"itemGroupId": "google_tee",
"mpn": "608802531649",
"price": {
"value": "21.99",
"currency": "USD"
},
"sizes": [
"Medium"
],
"includedDestination": [
"Shopping"
]
}
}
]
}
custombatch:get
The following request URL makes a products.custombatch
call with
method=get
:
POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch
To get a product, specify the batchId
that is unique to the product
for the API call, the merchantId
of the merchant authorized to make the
API call, the method get
, and the productId
of the product being retrieved.
The following is a sample JSON request body for retrieving the two products
inserted using the previous custombatch:insert
example, specified
by their productId
values. The batchId
is unique for each item in the list:
{
"entries": [
{
"batchId": 1113,
"merchantId": 1234567,
"method": "get",
"productId": "online:en:US:1111111111"
},
{
"batchId": 1114,
"merchantId": 1234567,
"method": "get",
"productId": "online:en:US:2222222222"
}
]
}
This call returns an HTTP 200
code and the following response body:
{
"kind": "content#productsCustomBatchResponse",
"entries": [
{
"kind": "content#productsCustomBatchResponseEntry",
"batchId": 1113,
"product": {
"kind": "content#product",
"id": "online:en:US:1111111111",
"offerId": "1111111111",
"title": "Google Tee Black",
"description": "The Black Google Tee is available in unisex sizing and features a retail fit.",
"link": "http://my.site.com/blacktee/",
"imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg",
"contentLanguage": "en",
"targetCountry": "US",
"feedLabel": "US",
"channel": "online",
"ageGroup": "adult",
"availability": "in stock",
"availabilityDate": "2019-01-25T13:00:00-08:00",
"brand": "Google",
"color": "black",
"condition": "new",
"gender": "male",
"googleProductCategory": "1604",
"gtin": "608802531656",
"itemGroupId": "google_tee",
"mpn": "608802531656",
"price": {
"value": "21.99",
"currency": "USD"
},
"sizes": [
"Large"
],
"includedDestination": [
"Shopping"
]
}
},
{
"kind": "content#productsCustomBatchResponseEntry",
"batchId": 1114,
"product": {
"kind": "content#product",
"id": "online:en:US:2222222222",
"offerId": "2222222222",
"title": "Google Tee Green",
"description": "100% cotton jersey fabric sets this Google t-shirt above the crowd.
Features the google logo across the chest. Unisex sizing.",
"link": "http://my.site.com/greentee/",
"imageLink": "https://shop.example.com/.../images/GGOEGXXX0906.jpg",
"contentLanguage": "en",
"targetCountry": "US",
"feedLabel": "US",
"channel": "online",
"ageGroup": "adult",
"availability": "in stock",
"availabilityDate": "2019-01-25T13:00:00-08:00",
"brand": "Google",
"color": "green",
"condition": "new",
"gender": "male",
"googleProductCategory": "1604",
"gtin": "608802531649",
"itemGroupId": "google_tee",
"mpn": "608802531649",
"price": {
"value": "21.99",
"currency": "USD"
},
"sizes": [
"Medium"
],
"includedDestination": [
"Shopping"
]
}
}
]
}
custombatch:delete
The following request URL is used to make a products.custombatch
with
method=delete
:
POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch
To delete a product, specify the batchId
that is unique to the
product within this API call, the merchantId
of the merchant authorized to
make this API call, the method delete
, and the productId
of the product
being deleted.
{
"entries": [
{
"batchId": 1115,
"merchantId": 1234567,
"method": "delete",
"productId": "online:en:US:1111111111"
},
{
"batchId": 1116,
"merchantId": 1234567,
"method": "delete",
"productId": "online:en:US:2222222222"
}
]
}
This call returns an HTTP 200
code and the batchId
values of the deleted
items:
{
"kind": "content#productsCustomBatchResponse",
"entries": [
{
"kind": "content#productsCustomBatchResponseEntry",
"batchId": 1115
},
{
"kind": "content#productsCustomBatchResponseEntry",
"batchId": 1116
}
]
}