| post_to_api | R Documentation |
Makes a POST request to an API endpoint with automatic retry on failure.
Implements exponential backoff and respects retry-after headers.
post_to_api(
url,
headers,
body,
max_retries = 2,
initial_delay_ms = 2000,
backoff_factor = 2,
timeout_seconds = NULL,
total_timeout_seconds = NULL,
first_byte_timeout_seconds = NULL,
connect_timeout_seconds = NULL,
idle_timeout_seconds = NULL
)
url |
The API endpoint URL. |
headers |
A named list of HTTP headers. |
body |
The request body (will be converted to JSON). |
max_retries |
Maximum number of retries (default: 2). |
initial_delay_ms |
Initial delay in milliseconds (default: 2000). |
backoff_factor |
Multiplier for delay on each retry (default: 2). |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds.
Defaults to |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in
seconds. Defaults to |
connect_timeout_seconds |
Optional connection-establishment timeout in
seconds. Defaults to |
idle_timeout_seconds |
Optional stall timeout in seconds. When set, the
request is aborted only if transfer progress drops below 1 byte/second for
the full interval. Defaults to |
The parsed JSON response.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.