http function

Make a HTTP request

Make a HTTP request

http(req, method = "GET") http_client(req)

Arguments

  • req: A req class object
  • method: (character) Pick which HTTP method to use. Only GET and POST for now. Default: GET

Details

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.

Examples

## 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)
  • Maintainer: Scott Chamberlain
  • License: MIT + file LICENSE
  • Last published: 2016-01-03