About Tags

About Tags

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

deleteTags

deleteTags allows you to delete tags.

Request Parameters

  • uri - URI of the resource. This is the URI value obtained from a fullview or metadata response.

Code Sample

try {
	
	$response = $sdk->deleteTags($uri);
	$response = json_decode($response->getBody()->getContents(),true);

	
	} catch (Exception $e) {
		
	 	try
		{
	  	   return $e->getResponse();	
		}
		finally {
		   return $e->getMessage();
		}

getTags

getTags allows you to retrieve tags.

Request Parameters

  • path - The path to the file or folder for which tags are to be retrieved.

Code Sample

try {
	
	$response = $sdk->getTags($path);
	$response = json_decode($response->getBody()->getContents(),true);
	
	} catch (Exception $e) {
		
	 	try
		{
	  	   return $e->getResponse();	
		}
		finally {
		   return $e->getResponse()->getBody()->getContents();
		}
	}

Example Return Response

{
	"Tags": "string"
}

setTags

setTags updates tags for a file or folder under the specified path.

Request Parameters

  • uri - URI of the resource. This is a URI value obtained from a fullview or metadata response.
  • Tags - A set of Tags
  • createVersion - If true, creates a new version of the file or folder. Defaults to false.

Code Sample

try {
	
	$response = $sdk->setTags($uri,$tag);
	$response = json_decode($response->getBody()->getContents(),true);
	
	} catch (Exception $e) {
	 	try
		{
	  	   return $e->getResponse();	
		}
		finally {
		   return $e->getMessage();
		}
	}

Example Return Response

{
	"Tags": "string"
}

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