powered by
There are three steps needed to perform a HTTP request with httr2:
Create a request object with request(url) (this function).
request(url)
Define its behaviour with req_ functions, e.g.:
req_
req_headers() to set header values.
req_headers()
req_url_path() and friends to modify the url.
req_url_path()
req_body_json() and friends to add a body.
req_body_json()
req_auth_basic() to perform basic HTTP authentication.
req_auth_basic()
req_oauth_auth_code() to use the OAuth auth code flow.
req_oauth_auth_code()
Perform the request and fetch the response with req_perform().
req_perform()
request(base_url)
An HTTP request: an S3 list with class httr2_request.
httr2_request
Base URL for request.
request("http://r-project.org")
Run the code above in your browser using DataLab