if (FALSE) {
# get a webproperty per account
getAccountInfo <- gar_api_generator(
"https://www.googleapis.com/analytics/v3/management/accounts",
"GET", data_parse_function = function(x) unique(x$items$id))
getWebpropertyInfo <- gar_api_generator(
"https://www.googleapis.com/analytics/v3/management/", # don't use sprintf to construct this
"GET",
path_args = list(accounts = "default", webproperties = ""),
data_parse_function = function(x) x$items)
walkData <- function(){
# here due to R lazy evaluation
accs <- getAccountInfo()
gar_batch_walk(getWebpropertyInfo,
walk_vector = accs,
gar_paths = list("webproperties" = ""),
path_walk = "accounts",
batch_size = 100, data_frame_output = FALSE)
}
# do the walk
walkData()
# to walk body data, be careful to modify a top level body name:
changed_emails <- lapply(email, function(x){userRef = list(email = x)})
batched <- gar_batch_walk(users,
walk_vector = changed_emails,
the_body = list(
permissions = list(
local = list(permissions)
),
userRef = list(
email = email[[1]]
)
),
body_walk = "userRef",
batch_size = 300,
data_frame_output = FALSE)
}
Run the code above in your browser using DataLab