About Virtual Folders

About Virtual Folders

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

createVirtualFolder

createVirtualFolder allows you to create a virtual folder.

Request Parameters

  • name – The name of the virtual folder.

Code Sample

try {
        $response = $sdk->createVirtualFolder($name);
    } catch (Exception $e) {

        try
        {
           return $e->getResponse();    
        }
        finally {
           if(is_object($e))
            {
                return $e->getResponse()->getBody()->getContents();
            }
            else
            {
                return false;
            }
        }
    }

Example Return Response

{
    "name": "string",
    "parentPath": "string",
    "size": 0,
    "immutable": false,
    "versionCreated": "string"
}

deleteVirtualFolder

deleteVirtualFolder deletes a virtual folder.

Request Parameters

  • name – The name of the virtual folder.
  • force - If set to:
    • false(default) - the virtual folder is not deleted if it contains any files or folders or references to deleted files or folders.
    • true - the virtual folder is deleted only if it contains references to deleted files or folders.

Code Sample

try {
    $response = $sdk->deleteVirtualFolder($virtualfoldername, $force);
    
    } catch (Exception $e) {
        try
        {
           return $e->getResponse();    
        }
        finally {
           if(is_object($e))
            {
                return $e->getResponse()->getBody()->getContents();
            }
            else
            {
                return false;
            }
        }
    }  

renameVirtualFolder

renameVirtualFolder allows you to rename a virtual folder.

Request Parameters

  • src – The current name of a virtual folder.
  • target - The new name of a virtual folder.

Code Sample

   try {
    $response = $sdk->renameVirtualFolder($source,$target);
    
    } catch (Exception $e) {
        
        try
        {
           return $e->getResponse();    
        }
        finally {
           if(is_object($e))
            {
                return $e->getResponse()->getBody()->getContents();
            }
            else
            {
                return false;
            }
        }
    } 

Example Return Response

{
    "name": "string",
    "parentPath": "string",
    "size": 0,
    "immutable": false,
    "versionCreated": "string"
}

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