Osapi.BatchRequest (v0.9)
NeedsExamples
Batch Request Objects
Service requests can be combined into a single batch request using the following methods:
Methods
osapi.newBatch
;<static> osapi.BatchRequest osapi.newBatch()
Returns
TypeDescription |
A new batch request. |
Description
Creates a new batch request.
osapi.BatchRequest.add
;<static> osapi.BatchRequest osapi.add(key, request)
Parameters
NameTypeDescription |
key |
String |
A key to access the result of the given request from the parameter sent to the callback function. |
request |
A request to add to the batch. |
Returns
TypeDescription |
A batch request containing the given request (and any previously added requests). |
Description
Adds a service request to the batch associated with the specified key. A single batch request can contain both JSON-RPC calls (e.g. osapi.people.get()) and HTTP calls to third parties (e.g. osapi.http.get()).
osapi.BatchRequest.execute
;<static> osapi.Request.execute(callback)
Parameters
NameTypeDescription |
callback |
Function |
A callback function to handle the response. |
Description
Executes all of the requests in the batch. Takes a callback for response processing, which is passed a JSON object mapping each request key to a JSON response object.
{{ JsApiAlphaList_(v0.9) }}