Turn a list of gar_fetch_functions into batch functions

gar_batch(call_list, ...,
  batch_endpoint = getOption("googleAuthR.batch_endpoint", default =



a list of functions from gar_api_generator


further arguments passed to the data parse function of f


the batch API endpoint to send to


A list of the Google API responses


This function will turn all the individual Google API functions into one POST request to /batch.

If you need to pass multiple data parse function arguments its probably best to do it in separate batches to avoid confusion.

See also


Documentation on doing batch requests for the search console API. Other Google APIs are similar.

Walk through API calls changing parameters using gar_batch_walk

Other batch functions: gar_batch_walk


# NOT RUN { ## usually set on package load options(googleAuthR.batch_endpoint = "https://www.googleapis.com/batch/urlshortener/v1") ## from goo.gl API shorten_url <- function(url){ body = list(longUrl = url) f <- gar_api_generator("https://www.googleapis.com/urlshortener/v1/url", "POST", data_parse_function = function(x) x$id) f(the_body = body) } ## from goo.gl API user_history <- function(){ f <- gar_api_generator("https://www.googleapis.com/urlshortener/v1/url/history", "GET", data_parse_function = function(x) x$items) f() } gar_batch(list(shorten_url("http://markedmondson.me"), user_history())) # }