Requests

Create and modify

request()

Create a new HTTP request

req_body_raw() req_body_file() req_body_json() req_body_form() req_body_multipart()

Send data in request body

req_headers()

Modify request headers

req_method()

Set HTTP method in request

req_template()

Set request method/path from a template

req_timeout()

Set time limit for a request

req_url() req_url_query() req_url_path() req_url_path_append()

Modify request URL

req_user_agent()

Set user-agent for a request

Debugging/testing

last_response() last_request()

Retrieve most recent request/response

req_dry_run()

Perform a dry run

req_verbose()

Show extra output when request is performed

with_mock() local_mock()

Temporarily mock requests

with_verbosity()

Temporarily set verbosity for all requests

Authentication

req_auth_basic()

Authenticate request with HTTP basic authentication

req_auth_bearer_token()

Authenticate request with bearer token

req_oauth_auth_code()

OAuth authentication with authorization code

req_oauth_bearer_jwt()

OAuth authentication with a bearer JWT

req_oauth_client_credentials()

OAuth authentication with client credentials

req_oauth_device()

OAuth authentication with device flow

req_oauth_password()

OAuth authentication with username and password

req_oauth_refresh()

OAuth authentication with a refresh token

Perform a request and get a response

req_perform()

Perform a request

req_stream()

Perform a request, streaming data back to R

multi_req_perform()

Perform multiple requests in parallel

Control the process

These functions don’t modify the HTTP request that is sent to the server, but affect the overall process of req_fetch().

req_cache()

Automatically cache requests

req_error()

Control handling of HTTP errors

req_throttle()

Throttle a request by automatically adding a delay

req_retry()

Control when a request will retry, and how long it will wait between tries

Handle the response

resp_body_raw() resp_body_string() resp_body_json() resp_body_html() resp_body_xml()

Extract body from response

resp_content_type() resp_encoding()

Extract response content type and encoding

resp_date()

Extract request date from response

resp_headers() resp_header() resp_header_exists()

Extract headers from a response

resp_link_url()

Parse link URL from a response

resp_raw()

Show the raw response

resp_retry_after()

Extract wait time from a response

resp_status() resp_status_desc() resp_is_error() resp_check_status()

Extract HTTP status from response

Miscellaenous helpers

curl_translate() curl_help()

Translate curl syntax to httr2

secret_make_key() secret_encrypt() secret_decrypt() secret_write_rds() secret_read_rds() secret_has_key()

Secret management

obfuscate() obfuscated()

Obfuscate mildly secret information

url_parse() url_build()

Parse and build URLs

OAuth

These functions implement the low-level components of OAuth.

oauth_client()

Create an OAuth client

oauth_client_req_auth() oauth_client_req_auth_header() oauth_client_req_auth_body() oauth_client_req_auth_jwt_sig()

OAuth client authentication

oauth_token()

Create an OAuth token

jwt_claim() jwt_encode_sig() jwt_encode_hmac()

Create and encode a JWT