| SapiClient-class | R Documentation |
Client for working with Keboola Connection Storage API.
bucketExists(bucketId)Check that a bucket exists.
bucketId Bucket ID.
TRUE or FALSE
createBucket(name, stage, description, backend = "redshift")Create a new bucket.
name Name of the bucket.
stage One of in, out, sys.
description Arbitrary description of the bucket.
name Database backend - eithe mysql or redshift.
List with bucket details.
createConfigurationRow(componentId, configId, rowId, configuration = list())Create a new component configuration row.
componentId Component ID.
configurationId Configuration ID.
rowId ID for the row
configuration The configuration to be stored as the row.
The component configuration row
createCredentials(bucketId, credentialsName)Create read-only redshift credentials for a given bucket.
bucketId Bucket ID.
credentialsName Descriptive name for the credentials.
List with redshift credentials
createWorkspace(backend = NULL)Create a new workspace. If backend not specified, project default backend will be used.
backend Either 'redshift' or 'snowflake'.
The new workspace
decodeResponse(response)Internal method to process API response.
response List as returned from httr POST/GET method.
Response body - either list or string in case the body cannot be parsed as JSON.
deleteBucket(bucketId)Delete a bucket.
bucketId String ID of the bucket.
TRUE
deleteComponentConfiguration(componentId, configId)DELETE the provided component configuration. CAUTION: this action is irreversible.
componentId ID of the component
configId ID of the configuration
TRUE
deleteConfigurationRow(componentId, configId, rowId, configuration = list())DELETE the provided component configuration row.
componentId ID of the component
configId ID of the configuration
rowId ID of the configurationRow
TRUE
deleteCredentials(credentialsId)Delete redshift credentials.
credentialsId Credentials ID
TRUE
deleteFile(fileId)load a file from SAPI into your current R session.
fileId the id of the file to delete
TRUE
deleteTable(tableId)Delete a table.
tableId String ID of the table (including bucket ID).
TRUE
dropWorkspace(workspaceId)DELETE the provided workspace.
workspaceId ID of the workspace
TRUE
genericDelete(urlD, query = NULL)Generic DELETE method.
urlD Target URL.
query Query parameters.
TRUE for success. Will throw error if status code returned is not 204.
genericGet(urlG, query = NULL)Generic POST method.
urlG Target URL.
query Query parameters.
Decoded JSON body as a list of items.
genericPost(urlP, data = NULL)Generic POST method.
urlP Target URL.
data Body of the request.
Decoded JSON body as a list of items.
get(urlG, query = NULL)Generic GET method.
urlG Target URL.
query List of query arguments ex. list(foo = bar).
List with HTTP response.
getBucket(bucketId)Get bucket information.
bucketId Bucket ID.
List with bucket details.
getComponentConfiguration(componentId, configId)Get KBC Component Configuration.
componentId ID of the component
configId ID of the configuration
List containing component configuration
getConfigurationRow(componentId, configId, rowId)Get KBC Component Configuration Row.
componentId ID of the component
configId ID of the configuration
rowId ID of the configuration row
List containing component configuration
getCredentials(credentialsId)List read-only redshift credentials with a given name.
credentialsId Credentials name.
List with redshift credentials
getFileData(fileInfo)Get a file from the S3 storage
list File info list object (see getFileInfo()).
Data frame with file contents
getFileInfo(fileId, federationToken = 1)Get information about a file, including credentials.
fileId Storage file ID.
federationToken Use federation token?.
List with file information
getJobStatus(url)Make a status request to an async syrup job
url This will normally be the url returned from the
createTableAsync/importTableAsync methods.
List with job details
getS3Object(key, fileInfo)Get a file from the S3 storage
key Object Key to retrieve
list File info list object (see getFileInfo()).
Data frame with file contents
getTable(tableId)Get table information.
tableId Table ID (including bucket ID).
List with table details.
getWorkspace(workspaceId)Get KBC Workspace.
workspaceId ID of the workspace
List containing workspace object
importTable(tableId, options = list())Import a table from Storage into R. Wrapper for the importTableAsync function.
tableId String table ID (including bucket ID).
options List with additional options.
data.frame with table contents.
importTableAsync(tableId, options = list())Begin an export job of a table.
tableId String table Id (including bucket ID).
options List with additional parameters.
URL to ping for table creation status check.
initialize(token, url = "https://connection.keboola.com/v2/",
userAgent = "Keboola StorageApi R Client/v2")Constructor.
token KBC Storage API token.
url Optional URL of the provisioning API.
Another return value
listBuckets(options = list())Get a list of all buckets.
options List with additional options.
List of buckets.
listConfigurationRows(componentId, configId)Get KBC Component Configuration Rows.
componentId ID of the component
configId ID of the configuration
List of component configuration rows
listCredentials()List read-only redshift credentials.
List with redshift credentials
listFiles(tags = NULL, limit = NULL, offset = NULL)Get list of fileinfo objects about files in sapi.
tags list of tags
limi limit of # of files to return. SAPI default is 100
offset which page of results to return, SAPI default is 0 (first page).
List of fileInfo objects
listTables(bucket = NULL, options = list())Get a list of all tables.
bucket Bucket ID (if empty, list all tables).
options List with additional options.
List of tables.
listWorkspaces()Get KBC Workspaces.
List of workspace
loadFile(fileId, options)load a file from SAPI into your current R session.
fileId the id of the file to load (hint: use listFiles to find the id of the file you want to load)
the contents of the file
newComponentConfiguration(componentId, configurationId, name,
description = "")Create a new component configuration. Note that the configuration property must be put in a subsequent PUT call.
configurationId Configuration ID.
name Name of the cconfiguration
description Descriptiion for the configuration.
List with component configuration
prepareOptions(options)Internal helper for parsing options
options List.
List with options
putComponentConfiguration(componentId, configId, configuration)PUT the configuration property of the KBC Component Configuration.
componentId ID of the component
configId ID of the configuration
configuration the configuration property (should be of type list)
list of the new component configuration
putFile(fileName, tags = NULL)Get list of fileinfo objects about files in sapi.
fileName fileName including path if file not in the current directory
tags tags to describe the file
fileId of the created file
saveTable(df, bucket, tableName, fileName = "tmpfile.csv", options = list())Save a table to Storage. Wrapper for the saveTableAsync function.
df data.frame to save.
bucket String bucket ID.
tableName String table name.
fileName String name of temporary file to use, will be deleted when done.
options List with additional options.
String job ID
saveTableAsync(bucket, tableName, fileId, opts = list())Create/Overwrite a new table in a bucket ascynchronously.
Generally use the saveTable method
bucket Storage bucket ID.
tableName Table name.
fileId Id of file received from the uploadFile method.
opts List with additional parameters.
URL to ping for table creation status check.
tableExists(tableId)Check that a bucket exists.
tableId Table ID (including bucket ID).
TRUE or FALSE
updateConfigurationRow(componentId, configId, rowId, configuration = list())PUT the configuration property of the KBC Component Configuration Row.
componentId ID of the component
configId ID of the configuration
rowId ID of the row
configuration the configuration property (should be of type list)
list of the new component configuration
uploadFile(dataFile, options = list())Upload a file to AWS S3 bucket. (compression is not yet supported by this client)
string File to upload.
options List options. (For a full list of options please see the api docs).
Integer file ID of the uploaded file.
verifyToken()Get details of the current token
List containing details of this client's token
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.