request {httr2} | R Documentation |
Create a new HTTP request
Description
There are three steps needed to perform a HTTP request with httr2:
Create a request object with
request(url)
(this function).Define its behaviour with
req_
functions, e.g.:-
req_headers()
to set header values. -
req_url_path()
and friends to modify the url. -
req_body_json()
and friends to add a body. -
req_auth_basic()
to perform basic HTTP authentication. -
req_oauth_auth_code()
to use the OAuth auth code flow.
-
Perform the request and fetch the response with
req_perform()
.
Usage
request(base_url)
Arguments
base_url |
Base URL for request. |
Value
An HTTP request: an S3 list with class httr2_request
.
Examples
request("http://r-project.org")
[Package httr2 version 1.0.7 Index]