GET/POST from flywire (graphene) servers with appropriate authorisation token
Source:R/flywire-fetch.R
flywire_fetch.Rd
GET/POST from flywire (graphene) servers with appropriate authorisation token
Usage
flywire_fetch(
url,
body = NULL,
config = NULL,
token = NULL,
return = c("parsed", "text", "response"),
cache = FALSE,
retry = 0L,
include_headers = FALSE,
simplifyVector = TRUE,
...
)
Arguments
- url
Full URL for brainmaps API endpoint
- body
an R list with parameters that will be converted with
jsonlite::toJSON
and then passed on toPOST
. You can also pass aJSON
character vector to have more control of theJSON
encoding.- config
(optional) curl options, see
httr::config
for details.- token
Optional chunkedgraph token (otherwise the default one for the current segmentation will be used). Use
NA
to suppress use of a token.- return
One of "parsed", "text" (for raw JSON), or "response"
- cache
Whether or not to cache responses (default
FALSE
)- retry
The number of times to retry the operation (default 0,
FALSE
=>0
andTRUE
=>3). See the documentation of thetimes
argument ofhttr::RETRY
for further details.- include_headers
Whether to include basic headers from the http request as attributes on the parsed JSON object (default
TRUE
) whenparse.json=TRUE
.- simplifyVector
Whether to use
jsonlite::simplifyVector
- ...
additional arguments passed to the
httr::{RETRY}
function. This may include aconfig
list other named parameters etc.
Value
Either an R object based on parsing returned JSON, a character vector
containing the raw JSON or a httr::response
object,
depending on the value of return
.
authorisation
Your authorisation will be based on a chunked graph
token normally stored at
~/.cloudvolume/secrets/cave-secret.json
. See
https://github.com/seung-lab/cloud-volume#cave-secretjson for
the format. You will need to generate the token as advised by the FlyWire
team. Search or ask for help #help_software
in the FlyWire slack if
you can't find the information. For more details see article on
accessing-graphene-server.
Examples
# \donttest{
# convert a flywire state URL into a parsed neuroglancer scene information
# but see also flywire_expandurl
json=flywire_fetch("https://globalv1.flywire-daf.com/nglstate/5747205470158848",
return="text")
ngl_segments(ngl_decode_scene(json), as_character = TRUE)
#> [1] "720575940619527173" "720575940628130268" "720575940630484179"
# }