fc_request: Create authentication headers

View source: R/fieldclimate.R

fc_headersR Documentation

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
)

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.

Value

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

a list with the parsed response.

See Also

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

Examples

fc_headers(path = "/user", public_key = "invalid", private_key = "invalid")
## Not run: 
fc_request("GET", "/user")

## End(Not run)

rfieldclimate documentation built on March 31, 2023, 5:33 p.m.