accept_json
and accept_xml
are useful
shortcuts to request json or xml responses if the server
supports content negotiation. json and xml are both easy
to work with in R. See parsed_content
for
how to access the results as R objects.add_headers(..., .headers = character()) accept_json()
accept_xml()
""
.authenticate
,
config
, set_cookies
,
timeout
, use_proxy
,
user_agent
, verbose
add_headers(a = 1, b = 2)
add_headers(.headers = c(a = "1", b = "2"))
# Override default headers with empty strings
GET("http://had.co.nz", verbose())
GET("http://had.co.nz", c(verbose(), add_headers(Accept = "")))
GET("http://httpbin.org/headers")
GET("http://httpbin.org/headers",
add_headers(version = version$version.string))
Run the code above in your browser using DataLab