Skip to content

Commit 72b7a3e

Browse files
committed
Update batch documentation
Update batch.md with discovery generated API sample Remove httpBatch.html sample since it is duplicative of batch.md and out of date(plus API does not exist anymore)
1 parent 2370756 commit 72b7a3e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

docs/batch.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ The JavaScript client library supports batching HTTP requests to make multiple A
77
The JavaScript client library defines an object called `Batch`. You can start by instantiating this object:
88

99
```js
10-
var batch = gapi.client.newBatch();
10+
const batch = gapi.client.newBatch();
1111
```
1212

1313
## Adding requests to the batch
1414

15-
Use the `Batch` object's [`add`](reference.md#----gapiclientbatchaddrequestopt_params--) method to add individual HTTP requests. The `add` method supports one optional parameter:
15+
Use the `Batch` object's [`add`](reference.md#----gapiclientbatchaddrequestopt_params--) method to add individual HTTP requests. Only requests created via [discovery](discovery.md) should be added to a batch. The `add` method supports one optional parameter:
1616

1717
<table>
1818
<colgroup>
@@ -49,19 +49,18 @@ Use the `Batch` object's [`add`](reference.md#----gapiclientbatchaddrequestopt_p
4949
Example:
5050

5151
```js
52-
var searchRequest = function(name) {
53-
return gapi.client.request({
54-
'path': 'plus/v1/people',
55-
'params': {'query': name}
56-
});
57-
};
58-
var searchAlvin = searchRequest('Alvin');
59-
var searchSimon = searchRequest('Simon');
52+
const getMe = gapi.client.people.people.get({
53+
'resourceName': 'people/me'
54+
});
55+
56+
const getYou = gapi.client.people.people.get({
57+
'resourceName': 'people/you'
58+
});
6059

6160
// Adding just the request
62-
batch.add(searchAlvin);
61+
batch.add(getMe);
6362
// Adding the request with an ID
64-
batch.add(searchSimon, {'id': 'searchSimon'});
63+
batch.add(getYou, {'id': 'getYou'});
6564
```
6665

6766
## Executing a batch

0 commit comments

Comments
 (0)