http {request} | R Documentation |
Make a HTTP request
http(req, method = "GET") http_client(req)
req |
A |
method |
(character) Pick which HTTP method to use. Only GET and POST for now. Default: GET |
By default, a GET request is made. Will fix this soon to easily allow a different HTTP verb.
The http
function makes the request and gives back the parsed result.
Whereas, the http_client
function makes the request, but gives back
the raw R6 class object, which you can inspect all parts of, modify, etc.
## Not run: # high level - http() api('https://api.github.com/') %>% api_path(repos, ropensci, rgbif, commits) %>% http() # low level - http_client() res <- api('https://api.github.com/') %>% api_path(repos, ropensci, rgbif, commits) %>% http_client() res$count() res$body() res$status() res$result res$links res$parse() # Specify HTTP verb api("http://httpbin.org/post") %>% api_body(x = "A simple text string") %>% http("POST") ## End(Not run)