motusQuery: Send a query to the motus API

Description Usage Arguments Value Note Author(s)

Description

Send a query to the motus API

Usage

1
2
motusQuery(API, params = NULL, requestType = "post", show = FALSE,
  json = FALSE, serno = NULL, masterKey = NULL)

Arguments

API

one of the MOTUS_API_... constants

params

named list of API-specific parameters

requestType

"post" or "get"

show

if TRUE, print the request to the console before submitting to motus

json

if TRUE, return results as JSON-format string; otherwise, as R list

serno

serial number of receiver from which request is being sent; if NULL, the default, uses MOTUS_SECRETS$serno.

masterKey

if NULL (the default), use key from the MOTUS_SECRETS object. Otherwise, masterKey is the name of a file to read the secret key from.

Value

the result of sending the request to the motus API. The result is a JSON-format character scalar if json is TRUE; otherwise it is an R list with named components, extracted from the JSON return value. If the query returns with a status code of >= 400, this function calls stop(X) where X is the (typically JSON-encoded) body of the reply.

Note

all queries and return values are logged in the file "motus_query_log.txt" in the user's home directory.

Author(s)

John Brzustowski jbrzusto@REMOVE_THIS_PART_fastmail.fm


jbrzusto/motus-R-package documentation built on May 18, 2019, 7:03 p.m.