Core HTTP logic for Seven Bridges API

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

Arguments

token

API auth token or access_token for Seven Bridges single sign-on.

version

API version number, default is v2.

path

path connected with base_url.

method

one of "GET", "POST", "PUT", or "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? Can be one of "json" (application/json), "form" (application/x-www-form-urlencoded), or "multipart" (multipart/form-data). Default is "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

advance_access

Enable advance access features? Default is FALSE.

authorization

Logical. Is the token an API auth token (FALSE) or an access token from the Seven Bridges single sign-on (TRUE)?

fields

All API calls take the optional query parameter fields. This parameter enables you to specify the fields you want to be returned when listing resources (e.g. all your projects) or getting details of a specific resource (e.g. a given project). For example, fields="id,name,size" to return the fields id, name and size for files. More details please check https://docs.sevenbridges.com/docs/the-api#section-general-api-information

base_url

defeault is "https://api.sbgenomics.com/v2"

...

passed to GET/POST/PUT/DELETE/PATCH 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 vignette and additional vignettes pages for more convenient usage.

References

https://docs.sevenbridges.com/v1.0/page/api

Examples

token <- "your_token" # list projects if (FALSE) { api(token = token, path = "projects", method = "GET")}