call_graph_endpoint | R Documentation |
Call the Microsoft Graph REST API
call_graph_endpoint(token, operation, ..., options = list(),
api_version = getOption("azure_graph_api_version"))
call_graph_url(token, url, ..., body = NULL, encode = "json",
http_verb = c("GET", "DELETE", "PUT", "POST", "HEAD", "PATCH"),
http_status_handler = c("stop", "warn", "message", "pass"),
simplify = FALSE, auto_refresh = TRUE)
token |
An Azure OAuth token, of class AzureToken. |
operation |
The operation to perform, which will form part of the URL path. |
... |
Other arguments passed to lower-level code, ultimately to the appropriate functions in httr. |
options |
A named list giving the URL query parameters. |
api_version |
The API version to use, which will form part of the URL sent to the host. |
url |
A complete URL to send to the host. |
body |
The body of the request, for |
encode |
The encoding (really content-type) for the request body. The default value "json" means to serialize a list body into a JSON object. If you pass an already-serialized JSON object as the body, set |
http_verb |
The HTTP verb as a string, one of |
http_status_handler |
How to handle in R the HTTP status code of a response. |
simplify |
Whether to turn arrays of objects in the JSON response into data frames. Set this to |
auto_refresh |
Whether to refresh/renew the OAuth token if it is no longer valid. |
These functions form the low-level interface between R and Microsoft Graph. call_graph_endpoint
forms a URL from its arguments and passes it to call_graph_url
.
If simplify
is TRUE
, call_graph_url
will exploit the ability of jsonlite::fromJSON
to convert arrays of objects into R data frames. This can be useful for REST calls that return tabular data. However, it can also cause problems for paged lists, where each page will be turned into a separate data frame; as the individual objects may not have the same fields, the resulting data frames will also have differing columns. This will cause base R's rbind
to fail when binding the pages together. When processing paged lists, AzureGraph will use vctrs::vec_rbind
instead of rbind
when the vctrs package is available; vec_rbind
does not have this problem. For safety, you should only set simplify=TRUE
when vctrs is installed.
If http_status_handler
is one of "stop"
, "warn"
or "message"
, the status code of the response is checked. If an error is not thrown, the parsed content of the response is returned with the status code attached as the "status" attribute.
If http_status_handler
is "pass"
, the entire response is returned without modification.
httr::GET, httr::PUT, httr::POST, httr::DELETE, httr::stop_for_status, httr::content
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.