Search Results for

    Show / Hide Table of Contents

    Plugin: SSH

    Introduction

    The plugin provides an easy way to transfer files over the web.

    Features

    Upload file

    Upload a file via the SSH protocol.

    Method Name: UploadV2

    Input

    • FileName(required): a string representing the name of the file to upload.
    • Bytes(required): the file content.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer the file to, default value is set in plugin settings.
    • Username(optional): a username for authentication, default value is set in plugin settings.
    • Password(optional): a password for authentication, default value is set in plugin settings.
    • AuthenticationType(optional): the authentication type; it can be password or private key.
    • PrivateKey(optional): a private key for authentication.
    • Passphrase(optional): a passphrase to protect the private key.
    • Override(optional): an option to override an existing file on upload. If no value is set in the plugin settings or parameters, the default is true.
    • CreateDirectory(optional): an option to create a directory on upload if it does not exist. If no value is set in the plugin settings or parameters, the default is true.

    Output Data object:

    • IsSuccess: True if the file transfers successfully, else False.
    • Data: The file content. Null if the transfer failed.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FileName", "file_name.csv" },
        { "Bytes", new byte[]{} },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "UploadV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    Download file

    Download file content via the SSH protocol.

    Method Name: DownloadV2

    Input

    • FileName(required): a string representing the name of the file to download.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer the file to, default value is set in plugin settings.
    • Username(optional): a username for authentication, default value is set in plugin settings.
    • Password(optional): a password for authentication, default value is set in plugin settings.
    • AuthenticationType(optional): the authentication type; it can be password or private key.
    • PrivateKey(optional): a private key for authentication.
    • Passphrase(optional): a passphrase to protect the private key.

    Output Data object:

    • IsSuccess: True if the file transfers successfully, else False.
    • Data: The file content. Null if the transfer failed.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FileName", "file_name.csv" },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "DownloadV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    Delete file

    Delete a file via the SSH protocol.

    Method Name: DeleteV2

    Input

    • FileName(required): a string representing the name of the file to delete
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer the file to, default value is set in plugin settings.
    • Username(optional): a username for authentication, default value is set in plugin settings.
    • Password(optional): a password for authentication, default value is set in plugin settings.
    • AuthenticationType(optional): the authentication type; it can be password or private key.
    • PrivateKey(optional): a private key for authentication.
    • Passphrase(optional): a passphrase to protect the private key.

    Output Data object:

    • IsSuccess: True if the file is deleted successfully, else False.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FileName", "file_name.csv" },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "DeleteV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    List files

    List files in a folder via the SSH protocol.

    Method Name: ListFilesV2

    Input

    • FolderName(required): a string representing the name of the folder to get files from.
    • LastModified(optional): get files whose LastWriteTimeUtc is greater than the LastModified value; gets all files in the folder by default.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer the file to, default value is set in plugin settings.
    • Username(optional): a username for authentication, default value is set in plugin settings.
    • Password(optional): a password for authentication, default value is set in plugin settings.
    • AuthenticationType(optional): the authentication type; it can be password or private key.
    • PrivateKey(optional): a private key for authentication.
    • Passphrase(optional): a passphrase to protect the private key.

    Output Data object:

    • IsSuccess: True if the files were retrieved successfully, else False.
    • Data: An array containing the list of files.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FolderName", "Archive/Incoming" },
        { "LastModified", new DateTime(2021, 12, 01) }
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "ListFilesV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    Move file

    Move a file to another location via the SSH protocol.

    Method Name: MoveFileV2

    Input

    • FileName(required): a string representing the name of the file to move.
    • ToFolder(required): a string representing the destination folder.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer the file to, default value is set in plugin settings.
    • Username(optional): a username for authentication, default value is set in plugin settings.
    • Password(optional): a password for authentication, default value is set in plugin settings.
    • AuthenticationType(optional): the authentication type; it can be password or private key.
    • PrivateKey(optional): a private key for authentication.
    • Passphrase(optional): a passphrase to protect the private key.

    Output Data object:

    • IsSuccess: True if the file is relocated successfully, else False.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "FileName", "file_name.csv" },
        { "FolderName", "Archive/Outgoing" },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "MoveFileV2", parameters);
    var output = pluginResult.GetObject("Data");
    

    Rename directory

    Rename a directory via the SSH protocol.

    Method Name: RenameDirectory

    Input

    • Path(required): a string representing the current path.
    • NewPath(required): a string representing the new path.
    • Host(optional): a server host, default value is set in plugin settings.
    • Port(optional): a server port, default value is set in plugin settings.
    • RootPath(optional): a root path to transfer the file to, default value is set in plugin settings.
    • Username(optional): a username for authentication, default value is set in plugin settings.
    • Password(optional): a password for authentication, default value is set in plugin settings.
    • AuthenticationType(optional): the authentication type; it can be password or private key.
    • PrivateKey(optional): a private key for authentication.
    • Passphrase(optional): a passphrase to protect the private key.

    Output Data object:

    • IsSuccess: True if the directory is renamed successfully, else False.
    • Error: Error message if any.

    Example

    var pluginApi = ctx.Use<IPluginApi>(); 
    var parameters = new Dictionary<string, object>()
    {
        { "Path", "Archive/Outgoing" },
        { "NewPath", "Archive/Outgoing_New" },
        { "Host", "127.0.0.1" },
        { "Port", 22 }
    };
    var pluginResult = pluginApi.Invoke("SSHPlugin", "RenameDirectory", parameters);
    var output = pluginResult.GetObject("Data");
    

    Installation

    Requirements

    • Casewhere v2.5 or later

    Configuration

    Configure the plugin as below:

    {
      "Host": "127.0.0.1",
      "Port": 22,
      "Username": // username,
      "Password": // password,
      "RootPath": "/C:/STFP",
      "Override": true,
      "CreateDirectory": true
    }
    

    Releases

    1.1.2

    Changelog

    • Add Override configuration. Default is true.
    • Add CreateDirectory configuration. Default is true.
    • Add new method RenameDirectory Download (login required): SSH Plugin v1.1.1 update link.

    1.1.1 - 21/03/2022

    Changelog

    • Update to the latest version of Renci.SshNet.
    • Add unit tests.
      Download (login required): SSH Plugin v1.1.1

    1.1.0 - 20/01/2022

    Changelog

    • UploadV2
    • DownloadV2
    • DeleteV2
    • ListFilesV2
    • MoveFileV2
      Download (login required): SSH plugin v1.1.0 update link.

    1.0.0 - 24/07/2021

    Changelog

    • Upload
    • Download
    • Delete
    • ListFiles
    • MoveFile
      Download (login required): SSH plugin v1.0.0 update link.
    In This Article
    Back to top Generated by DocFX