Make JAMES POST request
Arguments
- host
String with the host. The default is
"http://localhost:8080"
.- path
String with the path to the called end point, e.g.
"version"
,"data/upload"
or"data/upload/json"
.- query
A list with query arguments, for example,
list(auto_unbox = TRUE)
forjson
output, orlist(width = 7.09, height = 7.09)
forsvglite
.- txt
Data set. Could be a URL, local file, JSON string or JSON object.
- ...
Any other arguments passed to james functions via POST body
Value
Object of class c("james_httr", "response")
. The object extends
the httr::response object with the components:
messages
(messages generated by JAMES), warnings
(warnings generated
by JAMES), parsed
(parsed return value of the called end point), session
(the session key).
Examples
if (FALSE) { # \dontrun{
host <- "https://james.groeidiagrammen.nl"
# host <- "http://localhost:8080"
url <- paste0(
"https://raw.githubusercontent.com/growthcharts/jamesdemodata/",
"refs/heads/master/inst/json/examples/Laura_S.json")
fn <- system.file("extdata", "bds_v3.0", "smocc", "Laura_S.json",
package = "jamesdemodata", mustWork = TRUE)
js <- read_json_js(txt = fn)
jo <- read_json_jo(txt = fn)
#' try all inputs
m1 <- james_post(host = host, path = "data/upload/json", txt = fn)
m2 <- james_post(host = host, path = "data/upload/json", txt = js)
m3 <- james_post(host = host, path = "data/upload/json", txt = url)
m4 <- james_post(host = host, path = "data/upload/json", txt = jo)
} # }
if (FALSE) { # \dontrun{
# create, store and view an A4 SVG plot
r5 <- james_post(path = "/charts/draw/svglite", txt = url,
chartcode = "NMBA", selector = "chartcode",
query = list(height = 29.7/2.54, width = 21/2.54))
tmp <- tempfile(pattern = "chart", fileext = ".svg")
writeLines(r5$parsed, con = tmp)
browseURL(tmp)
unlink(tmp)
} # }