Skip to content

call_api¶

Call a Comet REST API endpoint

Description¶

This function is only meant for advanced users. If you would like to call any arbitrary Comet API endpoint that isn't natively supported by cometr, you can use this function.

Usage¶

call_api(
  endpoint,
  method = c("GET", "POST"),
  params = list(),
  parse_response = TRUE,
  response_json = TRUE,
  local_file_path = NULL,
  api_key = NULL
)

Arguments¶

ArgumentDescription
endpointThe REST API endpoint.
methodThe HTTP method to use, either "GET" or "POST".
paramsA list of parameters. For GET endpoints, the parameters are appended to the URL; for POST endpoints, the parameters are sent in the body of the request.
parse_responseIf TRUE, try to parse response from server.
response_jsonIf TRUE, try to parse the response as JSON. If FALSE, return the response as raw data, e.g. binary.
local_file_pathThe path to the local file for saving downloaded content if appropriate.
api_keyComet API key (can also be specified using the COMET_API_KEY parameter as an environment variable or in a comet config file).

Return Value¶

The parsed response

Sep. 30, 2024