Summary
Now you know how to make calls! The general template for making a call (after making sure authentication is set up) is as follows.
- Determine an endpoint for your service (possibly with the
servicesobject).
endpoint <- 'APIEndpoint'
- Make the call with
perform.call().
result <- perform.call(endpoint)
- If the call requires a single variable, declare the variable with the API variable name and pass it in as a second argument in
perform.call().
variable <- "value"
result <- perform.call(endpoint, variable)
Or, specify the name of the API variable in the third argument.
variable.code <- "value"
result <- perform.call(endpoint, variable.code, name = "API variable name")
- If the call requires multiple variables, make a list and pass it in as a second argument in
perform.call().
variables <- list(variable.one = "value.one",
variable.two = "value.two",
variable.three = "value.three")
result <- perform.call(endpoint, variables)
Or, specify the names of parameter codes in the second argument.
variables <- list("value.one", "value.two", "value.three")
result <- perform.call(endpoint,
variables,
name = list("variable.one", "variable.two", "variable.three"))