Skip to contents

Used for advanced users and the core method for higher level API in this package.

Usage

api(
  token = NULL,
  path = NULL,
  method = c("GET", "POST", "PUT", "DELETE", "PATCH"),
  query = NULL,
  body = list(),
  encode = c("json", "form", "multipart"),
  limit = getOption("sevenbridges2")$limit,
  offset = getOption("sevenbridges2")$offset,
  advance_access = getOption("sevenbridges2")$advance_access,
  authorization = FALSE,
  fields = "_all",
  base_url = NULL,
  url = NULL,
  ...
)

Arguments

token

API authentication token or access_token for Seven Bridges single sign-on. Authentication token uniquely identifies you on the Seven Bridges Platform and has all your data access, app management and task execution permissions. Read more about its usage here.

path

Path connected with base_url.

method

One of "GET", "POST", "PUT", "DELETE", or "PATCH".

query

Query parameters passed to httr package GET/POST call.

body

Body content passed to httr package GET/POST/PUT/DELETE/PATCH 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 httr::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

The maximum number of collection items to return for a single request. Minimum value is 1. The maximum value is 100 and the default value is 50. This is a pagination-specific attribute.

offset

The zero-based starting index in the entire collection of the first item to return. The default value is 0. This is a pagination-specific attribute.

advance_access

Enable advance access features? Default is FALSE.

authorization

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

fields

Selector specifying a subset of fields to include in the response. All API calls take this optional query parameter. 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. Default value is set to _all, so all fields are always returned for each resource. More details please check here.

base_url

Platform URL, default is NULL.

url

Full url of the resource. If url is provided, other parameters like base_url, path, query, limit, offset and fields will be ignored.

...

Other arguments passed to GET/POST/PUT/DELETE/PATCH call.

Value

Response in form of a list.

Examples

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