About Shares

About Shares

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

createShare

createShare allows you to create shares.

Code Sample

begin
    name = params[:name] || ''

    rname = params[:rname] || ''

    rtype = params[:rtype] || ''

    rsubType = params[:rsubType] || ''

    location = params[:location] || ''

    size = params[:size] || ''

    expiresIn = params[:expiresIn] || ''
    
    entry = client.createShare(name,rname,rtype,rsubType,location,size,expiresIn)

  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 "Sdk API error  #{e}"

    end

  end

Example Return Response

{
    "links": [{
        "rel": "string",
        "link": "string"
    }],
    "uid": "string",
    "name": "string",
    "owner": {},
    "sharer": {},
    "totalResourceCount": 0,
    "expiresIn": 0,
    "expirationDate": "string",
    "creationDate": "string",
    "lastModifiedDate": "string",
    "inboundLastModifiedDate": "string",
    "publicInviteKey": "string",
    "resources": [{
        "uid": "string",
        "name": "string",
        "type": "string",
        "subType": "string",
        "location": "string",
        "size": 0,
        "resourceId": "string",
        "contentToken": "string",
        "checksum": "string",
        "lastModifiedDate": "string"
        "url": "string"
    }]
}

deleteShare

deleteShare allows you to delete shares.

Code Sample

begin

    shareUid = params[:shareUid] || '' 
 
    entry = client.deleteShare(shareUid)

  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 "Sdk API error  #{e}"

    end

  end

getShares

getShares allows you to retrieve shares.

Code Sample

begin
   
    cursor = params[:cursor] || ""

    filter = params[:filter] || ""

    since = params[:since] || ""

    tillnow = params[:tillnow] || ""

    count = params[:count] || ""

    entry = client.getShares(cursor,filter,since,tillnow,count)

  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 "Sdk API error  #{e}"

    end

  end

Example Return Response

{
    "count": 0,
    "links": [{
        "rel": "string",
        "link": "string"
    }],
    "share": [{
        "links": [{
            "rel": "string",
            "link": "string"
        }],
        "uid": "string",
        "name": "string",
        "owner": {},
        "sharer": {},
        "totalResourceCount": 0,
        "expiresIn": 0,
        "expirationDate": "string",
        "creationDate": "string",
        "lastModifiedDate": "string",
        "url": "string"
        "inboundLastModifiedDate": "string",
        "publicInviteKey": "string"
    }]
}

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