Learn R Programming

rfieldclimate (version 0.1.1)

fc_headers: Create authentication headers

Description

authentication is done via hmac, see fc_headers().

Usage

fc_headers(
  method = c("GET", "PUT", "POST", "DELETE"),
  path = NULL,
  public_key = Sys.getenv("FC_PUBLIC_KEY"),
  private_key = Sys.getenv("FC_PRIVATE_KEY")
)

fc_request( method = c("GET", "PUT", "POST", "DELETE"), path = NULL, body = NULL, public_key = Sys.getenv("FC_PUBLIC_KEY"), private_key = Sys.getenv("FC_PRIVATE_KEY"), verbose = FALSE, timeout = 10 )

Value

an object of type "request" as returned by httr::add_headers().

a list with the parsed response.

Arguments

method

request method

path

request path (required)

public_key

public key. Read by default from env variable FC_PUBLIC_KEY

private_key

private key. Read by default from env variable FC_PRIVATE_KEY

body

request body named list. Will be passed to httr::VERB() and form-encoded.

verbose

logical, should the request be printed?

timeout

number of seconds to wait for a response before giving up.

See Also

https://api.fieldclimate.com/v2/docs/#authentication-hmac

Examples

Run this code
fc_headers(path = "/user", public_key = "invalid", private_key = "invalid")
if (FALSE) {
fc_request("GET", "/user")
}

Run the code above in your browser using DataLab