Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Next »

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 |

osapi.BatchRequest

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

osapi.Request

A request to add to the batch.

Returns
TypeDescription |

osapi.BatchRequest

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) }}

  • No labels