CARVIEW |
Select Language
HTTP/2 301
x-content-type-options: nosniff
cross-origin-resource-policy: cross-origin
cache-control: public, max-age=1800
expires: Fri, 18 Jul 2025 23:12:53 GMT
content-type: text/html; charset=UTF-8
location: https://developers.google.com/api-client-library/java/google-api-java-client/batch
date: Fri, 18 Jul 2025 22:42:53 GMT
server: sffe
content-length: 279
x-xss-protection: 0
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
HTTP/2 301
content-type: text/html; charset=utf-8
location: https://googleapis.github.io/google-api-java-client/batching.html
cache-control: private, max-age=2592000
pragma:
vary: Cookie
vary: Accept-Encoding
content-security-policy: base-uri 'self'; object-src 'none'; script-src 'strict-dynamic' 'unsafe-inline' https: http: 'nonce-SOzD9Hr8uiuZ256k9yMaE8I5UcPeE8' 'unsafe-eval'; frame-ancestors 'self' https://code-assist-free-tier-autopush.corp.google.com https://code-assist-free-tier-staging.corp.google.com https://code-assist-free-tier.corp.google.com https://*.proxy.googlers.com; report-uri https://csp.withgoogle.com/csp/devsite/v2
strict-transport-security: max-age=63072000; includeSubdomains; preload
x-xss-protection: 0
x-content-type-options: nosniff
expires: 0
content-encoding: gzip
x-cloud-trace-context: 5389929c9a313092e2997f38411a0f82
date: Fri, 18 Jul 2025 22:42:53 GMT
server: Google Frontend
content-length: 203
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
HTTP/2 200
server: GitHub.com
content-type: text/html; charset=utf-8
last-modified: Fri, 23 May 2025 14:25:54 GMT
access-control-allow-origin: *
etag: W/"68308572-1e76"
expires: Fri, 18 Jul 2025 22:52:53 GMT
cache-control: max-age=600
content-encoding: gzip
x-proxy-cache: MISS
x-github-request-id: 0919:1BDAE7:19D51:22815:687ACDEC
accept-ranges: bytes
age: 0
date: Fri, 18 Jul 2025 22:42:53 GMT
via: 1.1 varnish
x-served-by: cache-bom4739-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1752878574.761073,VS0,VE225
vary: Accept-Encoding
x-fastly-request-id: be53923d34c7a90fa68b8683080b6012e96942d9
content-length: 1896
Batching | Google APIs Client Library for Java
Setup Instructions
Component Modules
Android
Google App Engine
Batching
Media Download
Media Upload
OAuth 2.0
Timeouts and Errors
Support
Google APIs Client Library for Java
OverviewSetup Instructions
Component Modules
Android
Google App Engine
Batching
Media Download
Media Upload
OAuth 2.0
Timeouts and Errors
Support
Batching
Each HTTP connection that your client makes results in overhead. To reduce overhead, you can batch multiple API calls together into a single HTTP request.
The main classes of interest are BatchRequest and JsonBatchCallback. The following example shows how to use these classes with service-specific generated libraries:
JsonBatchCallback<Calendar> callback = new JsonBatchCallback<Calendar>() {
public void onSuccess(Calendar calendar, HttpHeaders responseHeaders) {
printCalendar(calendar);
addedCalendarsUsingBatch.add(calendar);
}
public void onFailure(GoogleJsonError e, HttpHeaders responseHeaders) {
System.out.println("Error Message: " + e.getMessage());
}
};
...
Calendar client = Calendar.builder(transport, jsonFactory, credential)
.setApplicationName("BatchExample/1.0").build();
BatchRequest batch = client.batch();
Calendar entry1 = new Calendar().setSummary("Calendar for Testing 1");
client.calendars().insert(entry1).queue(batch, callback);
Calendar entry2 = new Calendar().setSummary("Calendar for Testing 2");
client.calendars().insert(entry2).queue(batch, callback);
batch.execute();