wcPOST: Send POST to Wildlife Computers Data Portal API

View source: R/wcPOST.R

wcPOSTR Documentation

Send POST to Wildlife Computers Data Portal API

Description

wcPOST returns a response from a POST to the API

Usage

wcPOST(
  wc.key = Sys.getenv("WCACCESSKEY"),
  wc.secret = Sys.getenv("WCSECRETKEY"),
  keyfile = NULL,
  params = "action=get_deployments"
)

Arguments

wc.key

public access key (default retrieves from option value set in .Renviron)

wc.secret

secret access key (default retrieves from option value set in .Renviron)

keyfile

path to a json formatted keyfile with WCACCESSKEY and WCSECRETKEY

params

POST message (default returns a list of deployments)

Details

This function provides basic access to the API via POST. The params value contains the string to include in the body of the POST. The default action is to return a list of deployments associated with your account . Most users will likely not call this function directly, but instead, rely on other helper/wrapper functions within the package.

The Wildlife Computers Data Portal API uses a form of keyed-hash message authentication code for secure access. Your 'Access Key' and 'Secret Key' can be obtained from the data portal website (Account Settings > Web Services Security). For security reasons you should NOT include the keys as plain text in any scripts. Instead, include the key values as within your .Renviron.

Value

an httr response object is returned. Content of the response can be obtained with the httr::content() function.

Setting key values within .Renviron

This option is a preferred option for storing keys, passwords and other sensitive values. Your .Renviron should be secured via OS security/permissions (e.g. on Linux/OS X .Renviron is stored within the home directory which is only accessible by an authorized user. However, you should not share your .Renviron or include your .Renviron in version control (e.g. git) if you use this option. An alternative is to read values from a different file in the home directory or to use OS level environment variables.

preformatted WCACCESSKEY = 'E4iZhsfdje7590JDNR/VARTEZyhfwb84485X5Xw86ow=' WCSECRETKEY = 'WIRJFYhfjdsuSEqKoE7WSDvXUHzVP0pHDJSscmeA7fw='


jmlondon/wcUtils documentation built on March 19, 2024, 8:40 a.m.