File And Folder Operations

File and Folder Operations

Version 1.5 - Updated on 03/23/2017

Contents

commitChunkedUpload(requestObject)

Used to finalize a chunked file upload. Until this method is called a chunked upload is not available to the user.

  • Parameters:
    • requestObject — Callbacks and parameters
    • requestObject.commiturl — Commit URL returned from a call to fileuploadIntent when chunked parameter is set to true
    • requestObject.success — Success callback function. Returns the response in the first argument.
    • requestObject.failure — Failure callback function. Returns the response in the first argument.
  • Returns: None. This method is asynchronous. Clients should use callback methods.

copyFile(requestObject)

Copies a file or a folder.

  • Parameters:

    • requestObject — Callbacks and parameters
    • requestObject.src — Full path of the file or folder
    • requestObject.target — Full path of the target file or folder to be copied. In the case of files, the changed name should be included in the target.
    • requestObject.safe
      • If set to true, name conflicts are resolved according to the value of the conflictsolve parameter.
      • If set to false, an existing file or folder with the same name is overwritten. False is default.

    • requestObject.conflictsolve — Defines how name conflicts are resolved if the safe parameter is set to true.

      • If set to copy, a new file is written to the destination folder with a non-conflicting name.
      • If not set, the operation is rolled back and returns 409 Conflict error message.

    • requestObject.success — Success callback function. Returns the response in the first argument.

    • requestObject.failure — Failure callback function. Returns the response in the first argument.

    • Returns: None. This method is asynchronous. Clients should use callback methods.

    createFolder(requestObject)

    Creates a folder.

    • Parameters:
      • requestObject — Callbacks and parameters
      • requestObject.success — Success callback function. Returns the response in the first argument.
      • requestObject.failure — Failure callback function. Returns the response in the first argument.
      • requestObject.name — Name of the folder to be created.
      • requestObject.path — Path of the parent folder where the folder is to be created.
    • Returns: None. This method is asynchronous. Clients should use callback methods.

    NOTE:
    You cannot perform the createFolder operation on a virutal folder.

    deleteFile(requestObject)

    Deletes a file or a folder.

    • Parameters:
      • requestObject — Callbacks and parameters
      • requestObject.success — Success callback function. Returns the response in the first argument.
      • requestObject.failure — Failure callback function. Returns the response in the first argument.
      • requestObject.path — Path of the file or folder to be deleted.
    • Returns: None. This method is asynchronous. Clients should use the callback methods.

    NOTE:
    You cannot perform the deleteFile operation on a virutal folder.

    fileuploadIntent(requestObject)

    Starts the upload process. Clients can request either chunked or un-chunked uploads. Chunked uploads must be used for files larger than 100 MB.

    • Parameters:
      • requestObject — Callbacks and parameters
      • requestObject.size — Size of the file to be uploaded
      • requestObject.chunk
        • True for chunked upload.
        • False for non-chunked upload. Default is false.
      • requestObject.path — full path of the folder where the file is getting uploaded
      • requestObject.name — Name of the file to be uploaded
      • requestObject.checksum — SHA256 checksum of the file
      • requestObject.success — Success callback function. Returns the response in the first argument.
      • requestObject.failure — Failure callback function. Return the response in the first argument.
    • Returns: None. This method is asynchronous. Clients should use callback methods.

    NOTE:
    You cannot perform the fileuploadIntent operation on a virutal folder.

    fullview(requestObject)

    Retrieves information about files and folders inside a user’s Personal Cloud Storage. Returns an etag that can be passed in subsequent calls to fullviews to stay in sync with deltas.

    • Parameters:
      • requestObject — Callbacks and parameters
      • requestObject.success — Success callback function. Returns the response in the first argument.
      • requestObject.failure — Failure callback function. Returns the response in the first argument.
      • requestObject.etag — Value received from a previous fullview call, used to keep clients in sync with a user’s changes.
    • Returns: None. This method is asynchronous. Clients should use callback methods.

    getDownloadUrl(path)

    Retrieves a URL that can be used to download a file. The client must use the URL.

    • Parameters: path — Path to the file
    • Returns: Download URL of the file

    getThumbnailUrl(contentToken, size, th, tw)

    Retrieves the URL of a thumbnail representing a file. The call is not successful until used by a client.

    • Parameters:
      • contentToken — Content token obtained from a call to metadata or fullview.
      • size — Size and width of the thumbnail
      • th — Height of the thumbnail
      • tw — Width of the thumbnail
    • Returns: h — URL of the thumbnail

    metadata(requestObject)

    Metadata API call used to list the contents of directories inside the file system, analagous to the linux ‘ls’ operation. If no path is provided the root ‘/’ is assumed.

    • Parameters:
      • requestObject — Callbacks and parameters
      • requestObject.success — Success callback function. Returns the response in the first argument.
      • requestObject.failure — Failure callback function. Returns the response in the first argument
      • requestObject.path — Path to the folder for which the user wants to retrieve metadata. If no path is given the root ‘/’ is assumed.
    • Returns: None. This method is asynchronous. Clients should use callback methods.

    move(requestObject)

    Moves a file or a folder.

    • Parameters:
      • requestObject — Callbacks and parameters
      • requestObject.success — Success callback function. Returns the response in the first argument.
      • requestObject.failure — Failure callback function. Returns the response in the first argument.
      • requestObject.src — Path of the file or folder
      • requestObject.target — Path of the target file or folder to be moved. In case of files, the the changed path should be included in the target.
      • requestObject.safe
        • If set to true, name conflicts are resolved according to the value of the conflictsolve parameter.
        • If set to false, an existing file or folder with the same name is overwritten. False is default.

      • requestObject.conflictsolve — Defines how name conflicts are resolved if the safe parameter is set to true. If set to copy, a new file is written to the destination folder with a non-conflicting name. If not set, the operation is rolled back and returns 409 Conflict error message.
      • Returns: None. This method is asynchronous. Clients should use callback methods.

      rename(requestObject)

      Renames a file or a folder.

      • Parameters:
        • requestObject — Callbacks and parameters
        • requestObject.success — Success callback function. Returns the response in the first argument.
        • requestObject.failure — Failure callback function. Returns the response in the first argument.
        • requestObject.src — Path of the file or folder
        • requestObject.target — Path of the target file or folder to rename. In case of files, the changed name should be included in the target.
        • requestObject.safe
          • If set to true, name conflicts are resolved according to the value of the conflictsolve parameter.
          • If set to false, an existing file or folder with the same name is overwritten. False is default.
        • requestObject.conflictsolve — Defines how name conflicts are resolved if the safe parameter is set to true. If set to copy, a new file is written to the destination folder with a non-conflicting name. If not set, the operation is rolled back and returns 409 Conflict error message.
        • Returns: None. This method is asynchronous. Clients should use callback methods.

        NOTE:
        You cannot perform the rename operation on a virutal folder.

        search(requestObject)

        Search method used to find files or folders matching a query.

        • Parameters:
          • requestObject — Callbacks and parameters
          • requestObject.count — Maximum number of items to include in a paginated response. Required, if start is specified. Default is 20, maximum is 100.
          • requestObject.query — Contains the text to be searched for and supports a number of query fields that allow clients to restrict the search to a particular parts of a file’s or folder’s metadata.
          • requestObject.sort — Specifies the sort order for a folder response. Syntax is: {field}+{asc or desc}. Valid values are: name, type, versionCreated, size, extension, album, artist, captureDate, compilation, contentType, creationDate, favorite, genre, height, modificationDate, priority, source, tags, title, timelineDate.
          • requestObject.start — Specifies which pages are to be returned in the response. Default is 1.
          • requestObject.success — Success callback function. Returns the response in the first argument.
          • requestObject.failure — Failure callback function. Returns the response in the first argument.
        • Returns: None. This method is asynchronous. Clients should use callback methods.

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