About Trash

About Trash

Contents

Introduction

For all the API calls, first create an object of the SDK class so that you can access the SDK functions.

To create an object of the SDK class, pass the following information to the SDK constructor:

  • clientKey - obtained when you created an application in Key Management
  • clientSecret - obtained when you created an application in Key Management
  • callbackUrl - HTTP callback address where the user can access the application. Your app must specify it exactly as you have entered it in Key Management as it is case sensitive.
$sdk = new Thingspace\Cloud\Sdk(clientKey,clientSecret,callbackUrl);

Examples

trash

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 or 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:
    • Set to false to stop at the topmost deleted item in the tree.
    • Set to true, to list all of the deleted items.

Code Sample

       try {
    $response = $sdk->trash($virtualfolder, $sort, $start, $count, $filter, $deep);
    $response = json_decode($response->getBody()->getContents(),true);
    } catch (Exception $e) {
        try
        {
           return $e->getResponse();    
        }
        finally {
           return false;
        }
    }

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"
        }]
    }
}

purgeTrash

trash deletes files and folder that are in a deleted state in a user’s Personal Cloud Storage account. Irrevocably deletes all paths that are marked as deleted at the time the call is made.

Request Parameters

  • virtualfolder – Folder that represents various client types at the root level and contains their respective data.
  • purge - Set to true to permanently delete the files and folders.

Code Sample

       try {
    $response = $sdk->purgeTrash($virtualfolder);
    } catch (Exception $e) {
        try
        {
           return $e->getResponse();    
        }
        finally {
           return false;
        }
    }

restoreTrash

restoreTrash restores files and folder that are marked as deleted.When called on a folder, the API creates a new version of the folder and any child folder, and restores all files in these folders.

Request Parameters as json array.

  • path – A json array of paths of trashed items.

Parameter request format

{
  "path": [
    "string"
  ]
}

Code Sample

   try {
    $response = $sdk->restoreTrash($path);
    } catch (Exception $e) {
        try
        {
           return $e->getResponse();    
        }
        finally {
           return false;
        }
    } 

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.