addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Extend your community

batch

POST /batch
  • json
Host: api.meetup.com
  • basic
api version 3

Performs multiple API requests in batch, useful for reducing HTTP network requests. This method is only available for OAuth authentication

Request Parameters

You may supply a limited number of API requests, typically 1 to 4, in one batch request using the required "requests" parameter. Each of these individual batched requests will be tallied separately the same way they would when making individual requests. The batch request itself will not be tallied. As such, batch requests can not be rate limited. The only failures that you should account for are an authentication failure or a malformed JSON encoding of requests provided with the "requests" parameter.

Composing batch requests

Requests should be provided within a JSON-encoded array in the following format attached the requests parameter within a POST body

 [{
   "path": "/2/member/self",
   "ref":  "me",
   "params": {
     "only": "name,id"
   }
 }]

Only "path" is required for HTTP GET requests. "path" represents the API path for the method. "ref" provides a way to tag a request in a batch with a label that you can associated with its response in the body of the batch response. This will default to the provided "path". You may also supply a "params" key with a JSON object representing the parameters provided for the request. At this time only HTTP GET, DELETE, and POST requests are supported. You may specify one of these as a "method" property of the request. Methods requiring a multipart form POST are currently not supported. You may also supply headers on a per request basis by adding a "headers" field to the JSON object representing the request as key value pairs of strings.

Interpreting batch responses

A response to a batch request will be in the format

 [{
   "path": "/2/member/self"
   "status": 200,
   "ref": "me",
   "body": {
     "id": 1234,
     "name": "Noah"
   },
   "headers": {
     "key": "value"
    }
 }]

"path" is the path of the method invoked. "status" represents the HTTP status code returned for the request. "ref" is the name provided for the inbound request. "body" is the JSON-encoded response from the given API request. "headers" is a JSON-encoded object representing the headers returned for that request. These requests may fail the same way they would when making individual requests. The response will indicate these failures.

In order to preserve server resources and return batch responses within a reasonable amount of time, individual requests may timeout if a response is not computed within a reasonable amount of time. This allows for some requests to fail and others to pass which is a nicer alternative to an all or nothing response timeout. A timed out request can be identified by inspecting its response's "status" field for a value of 504. A timed out response may look like.

 [{
   "status" : 504,
   "body" : {
    "errors" : [{"code": "request_timeout", "message":"request timed out"}]
   },
   "headers" : { ... },
   "path" : "/end/point",
   "ref" : "request_ref"
 }]
requests

JSON-encoding of multiple request objects as described in the parameter notes

Response

The response will be a JSON-encoded array of responses to requests defined in the batch request

Examples

Below is an example of making batch request issued by the command line program, curl

# define a file containing the request body containing the requests to execute
cat batch.requests
requests=[{
  "path":"/2/member/self"
},{
  "path": "/2/events",
  "params": {
    "member_id":"self",
    "rsvp": "yes",
    "only":"name,time"
  }
}]

# perform an HTTP POST request with the body set to the contents of the batch.requests file
curl -H "Authorization: Bearer $OAUTH2_ACCESS_TOKEN" https://api.meetup.com/batch -d @batch.requests

You may also discard fields as you can do with any other method. Below is an example of only fetching the bodies of the responses to the requests.

curl -H "Authorization: Bearer $OAUTH2_ACCESS_TOKEN" https://api.meetup.com/batch?only=body -d @batch.requests

API methods

v3 batch

v2 categories

v2 cities

v2 dashboard

v1 groups

v1 oembed

v1 topics

v2 deprecated