Description Usage Arguments Details Examples
Make a HTTP request
1 2 3 | 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ## 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
## POST
api("https://httpbin.org/post") %>%
api_body(x = "A simple text string") %>%
http("POST")
## PUT
api("https://httpbin.org/put") %>%
api_body(x = "A simple text string") %>%
http("PUT")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.