In the Shopping Content API, a batch request could have multiple entries, and each entry can be any method (insert, update, delete, or custom) defined on the resource.
Merchant API does not offer custom batch methods. Instead, you can arrange parallel execution of individual requests.
With the client library
If using the client library, consider this Shopping Content API code.
ProductsCustomBatchResponse batchResponse =
content.products().custombatch(batchRequest).execute();
Write the Merchant API equivalent as follows.
List<ApiFuture<ProductInput>> futures;
for (InsertProductInputRequest request : requests) {
futures.add(productInputsServiceClient.insertProductInputCallable().futureCall(request));
}
List<ProductInput> responses;
for (ApiFuture<ProductInput> future : futures) {
responses.add(future.get());
}
Without the client library
If you aren't using the client library, accomplish batching as explained at Send multiple requests at once.
For example, replace a Content API for Shopping request like the following:
POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch
{
"entries": [
{
"method": "insert",
"product": { … }
} … ]
}
with this Write a batch request example.