Learn R Programming

sevenbridges (version 1.2.4)

api: wrapper of http logic for SBG API

Description

wrapper of http logic for SBG API

Usage

api(token = NULL, version = "1.1", path = NULL, method = c("GET", "POST", "PUT", "DELETE", "PATCH"), query = NULL, body = list(), encode = "json", limit = getOption("sevenbridges")$limit, offset = getOption("sevenbridges")$offset, base_url = paste0("https://api.sbgenomics.com/", version, "/"), ...)

Arguments

token
authenticate token string.
version
API version number, default 1.1.
path
path connected with base_url.
method
one of 'GET', 'POST', 'PUT', 'Delete'
query
Passed to httr package GET/POST call.
body
Passed to httr package GET/POST/PUT/DELETE call.
encode
If the body is a named list, how should it be encoded? Default here is "json". Can be one of form (application/x-www-form-urlencoded), multipart, (multipart/form-data), or json (application/json). For "multipart", list elements can be strings or objects created by upload_file. For "form", elements are coerced to strings and escaped, use I() to prevent double-escaping. For "json", parameters are automatically "unboxed" (i.e. length 1 vectors are converted to scalars). To preserve a length 1 vector as a vector, wrap in I().
limit
how many results to return
offset
the point at which to start displaying them
base_url
defeault is 'https://api.sbgenomics.com/1.1'
...
passed to GET/PUT/DELETE/PATCH/POST call.

Value

returned request list of httr

Details

Used for advanced users and the core method for higher level API in this package, please refer to the easy api manual and the two vignettes pages for more convenient usage.

References

https://docs.sbgenomics.com/display/developerhub/API

Examples

Run this code
token <- "fake_token"

## list projects
api(token = token, path = 'project', method = "GET")

Run the code above in your browser using DataLab