About Favorites

About Favorites

Contents

Introduction

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])

Examples

deleteFavorites

deleteFavorites API removes the specified files or folders from favorites.

Code Sample

 begin
    uri = params[:uri] || ''
    createVersion =  params[:createVersion] || ''
    entry = client.deleteFavorites(uri,createVersion)
  rescue SdkAuthError => e
    session.delete(:access_token)  # An auth error means the access token is probably bad
    return html_page "Sdk auth error"
  rescue SdkError => e
    if e.http_response.code == '404'
      return html_page "Path not found: #{e}"
    else
      return html_page "#{e}"
    end
  end

getFavorites

getFavorites API retrieves files and folders tagged as favorites in the specified virtual folder, sorted by last modified date.

Code Sample

  begin
    name = params[:virtualfolder] || ""
    type = params[:type] || ""
    filetype = params[:filetype] || ""
    entry = client.getFavorites(name,type,filetype)
  rescue SdkAuthError => e
    session.delete(:access_token)  # An auth error means the access token is probably bad
    return html_page "Sdk auth error"
  rescue SdkError => e
    if e.http_response.code == '404'
      return html_page "Path not found: #{e}"
    else
      return html_page "#{e}"
    end
  end

Example Return Response

{
	"count": 0,
	"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",
		"shareAssociation": [{
			"uid": "string",
			"visibility": "string",
			"name": "string",
			"type": "string"
		}]
	}],
	"folder": [{
		"name": "string",
		"parentPath": "string",
		"size": 0,
		"version": 0,
		"versionCreated": "string",
		"count": 0,
		"deleted": true,
		"viewUid": [{
			"type": "string",
			"viewType": "string",
			"uid": "string"
		}],
		"uri": "string",
		"shareAssociation": [{
			"uid": "string",
			"visibility": "string",
			"name": "string",
			"type": "string"
		}]
	}]
}

setFavorites

setFavorites API marks the specified files or folders as favorites.

Code Sample

 begin
    uri = params[:uri] || ''
    createVersion =  params[:createVersion] || ''
    uri = uri.split(',')
    favoriteslistdata = {"uri"=> uri, "createVersion"=> createVersion}
    favoriteslistdata = JSON.generate(favoriteslistdata)
    puts favoriteslistdata
    entry = client.setFavorites(favoriteslistdata)
  rescue SdkAuthError => e
    session.delete(:access_token)  # An auth error means the access token is probably   bad
    return html_page "Sdk auth error"
  rescue SdkError => e
    if e.http_response.code == '404'
      return html_page "Path not found: #{e}"
    else
      return html_page "#{e}"
    end
  end

Example Return Response

{
	"uri": [
		"string"
	],
	"createVersion": false
}

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