For all the API calls, you must first obtain an access token. The access token is used to create an instance of the SDK which allows you to access the SDk methods.
Code Sample
SdkClient.new(session[:access_token])
purgetrash
permanently deletes all the files and folder that are in a deleted state. Permanently deletes all paths that are marked as deleted at the time the call is made.
Required Parameters
-virtualfolder
– Folder that represents various client types at the root level and contains their respective data.
Code Sample
begin
entry = client.purgetrash(virtualfolder)
rescue SdkAuthError => e
session.delete(:access_token) # An auth error means the access token is probably bad
logger.info "Sdk auth error: #{e}"
return html_page "Sdk auth error"
rescue SdkError => e
logger.info e
if e.http_response.code == '404'
return html_page "Path not found: #{h path}"
else
return html_page "Sdk API error #{e}"
end
end
restore
restores files or folders that are marked as deleted. When called on a folder, the API creates a new version of the folder and any child folder, and then restores all files in these folders.
Request Parameters
path
– An array of paths to deleted items.Request Parameter Format
{
"path": [
"string"
]
}
Code Sample
begin
entry = client.restore(restorepath)
rescue SdkAuthError => e
session.delete(:access_token) # An auth error means the access token is probably bad
logger.info "Sdk auth error: #{e}"
return html_page "Sdk auth error"
rescue SdkError => e
if e.http_response.code == '404'
return html_page "Path not found: #{h path}"
else
logger.info "Sdk API error: #{e}"
return html_page "Sdk API error #{e}"
end
end
trash
retrieves a list of deleted files and folders from a user’s Personal Cloud Storage account.
Request Parameters
virtualfolder
– Folder that represents various client types at the root level and contains their respective data.sort
- Controls the sort order in which the response is returned. Uses the syntax: sort={field}+(asc|desc)
.start
- Starting point for partial responses, for folder requests. Default is 1.count
- Maximum items to include in a paginated response, for folder requests. Required if start is specified.filter
- Set to file or folder, to include only those types of items in the response.deep
- Specifies the depth of the response:Code Sample
begin
entry = client.trash(virtualfolder,sort,start,count,filter,deep)
rescue SdkAuthError => e
session.delete(:access_token) # An auth error means the access token is probably bad
logger.info "Sdk auth error: #{e}"
return html_page "Sdk auth error"
rescue SdkError => e
if e.http_response.code == '404'
return html_page "Path not found: #{h path}"
else
return html_page "Sdk API error #{e}"
end
end
Example Return Response
{
"count": 0,
"data": {
"file": [{
"name": "string",
"parentPath": "string",
"checksum": "string",
"contentAccessible": true,
"contentToken": "string",
"deleted": true,
"extension": "string",
"size": 0,
"systemAttributes": {},
"version": 0,
"versionCreated": "string",
"viewUid": [{
"type": "string",
"viewType": "string",
"uid": "string"
}],
"uri": "string"
}],
"folder": [{
"name": "string",
"parentPath": "string",
"size": 0,
"version": 0,
"versionCreated": "string",
"count": 0,
"deleted": true,
"viewUid": [null],
"uri": "string"
}]
}
}
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.