Skip to main content

FTP: Get Node

The FTP: Get Node allows a workflow to retrieve a file from an FTP or SFTP server.

FTP: Get Node

Node Properties

There are three main configuration sections for the FTP: Get Node ...

Connection Configuration

FTP: Get Node Credentials

First, enter the required information to establish the connection to the server.

  • Connection Method: SFTP, FTPS, or FTP.
  • Hostname: (Required) The address of the server.
  • Port: Defaults to 22 for SFTP and 21 for FTPS and FTP.

Depending on the chosen Connection Method, there are additional values to provide.

SFTP

  • Username: (Required) The username for establishing the SFTP connection.
  • Authentication Method: (Required) Choose one of the options and then fill in the provided input ...
    • Password: The password associated with the username.
    • Private Key: A private key for authenticating the user against the server.

FTPS

  • Username: The username for establishing the connection. This is required only if a password is provided, though most servers require this value.
  • Password: The password for the provided username. This is optional, but is required by most servers.

In addition, FTPS connections take the following optional SSL properties to establish a secure connection:

  • Client Certificate Key: A private key associated with the client certificate. Required if Client Certificate is provided.
  • Client Certificate: A TLS/SSL Certificate which verifies the identity of the client. Required if Client Certificate Key is provided.
  • Disable SSL Verification: If checked, the server certificate will not be checked against the supplied CA Certificate.
  • Custom CA Certificate: A certificate to compare against the server. Necessary only if the server is using a self-signed certificate. The input is disabled if the server is Disable SSL Verification is checked.

FTP

FTP connections are similar to FTPS connections in that most require a Username and Password; however, FTP connections are not established over secure channels and thus do not require SSL configuration.

File Configuration

FTP: Get Node Config

Next is to configure the fields required to retrieve a file. All applicable fields are templatable:

  • File Name: (Required) The basename of the file to retrieve.
  • Directory Name: (Required) The full path to a directory where the file is located.
  • File Encoding: (Required) The encoding of the file that you're retrieving. Defaults to UTF-8.

Result

Finally, enter a Result Path, which is a payload path for where to put the result of the FTP: Get Node's operation. If successful, the value placed at this path will be an object with a value property containing the file's contents - or, when writing the result to disk, a path to the file's downloaded location. If an error occurs, the value will be an error object containing information about the error, including a message string.

FTP: Get Node Output

Writing Result to Disk

In edge workflows running GEA version 2.1.0 or higher, you can save the retrieved file to the edge device's file system. To do so, choose "Write File Content to Disk" in the Result Mode dropdown menu and then provide a Local File Path Template, which is a string template resolving to a relative path in the agent's Docker container.

When selecting this option, you must also choose how to handle conflicts if the file already exists at the specified path:

  • Cancel and return an error if the file exists: The operation will fail and return an error if a file already exists at the specified path.
  • Append my content to the file if it exists: The fetched content will be appended to the end of the file if it already exists.
  • Overwrite the file with my new content if it exists: (Default) The existing file will be overwritten with the newly fetched content.

Limitations

The maximum size of a file that can be retrieved using the FTP: Get Node is 5 MB. However, this limit does not apply when writing the result to disk.

Node Example

When the operation successfully executes and the node is not writing the result to disk, the result will contain a value key with the contents of the file retrieved from the server.

{
"value": "This is my file's content"
}

When writing to disk, the result will contain a value key with the path to the file on the edge device.

{
"value": "/path/to/my/file.txt"
}

Node Errors

In the case of an error, the resulting object will contain an error key instead of the normal value key.

{
"error": {
"message": "530 Non-anonymous sessions must use encryption"
}
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.