Message Image  

Introducing the IBM App Connect SFTP node

 View Only
Wed July 01, 2020 11:02 AM

We’ve added an SFTP node to our IBM App Connect library for performing file-based operations using the Secure File Transfer Protocol.

The SFTP node supports the following events and actions:

SFTP events and actions. 

SFTP connection details

You can connect to cloud-based SFTP servers, or on-premises SFTP servers that are on a private network (by using an IBM secure gateway).

The connection details required to connect to an SFTP server are as follows:

  • SFTP service URL – The URL of the SFTP server (if connecting through a secure gateway) or the host name (if connecting to a cloud-based SFTP server).

    The format of the SFTP service URL depends on whether you are connecting to a cloud-based SFTP server or an on-premises SFTP server that is in a private network.

    • If the connection is to a cloud-based SFTP server, just specify the subdomain that the SFTP provider provides for the respective user account; for example:

      mydomain.fileprovider.com

    • If the connection is to an on-premises SFTP server that is in a private network, you need to use the IBM Secure Gateway and the SFTP service URL has the following format: http://<hostname/IP>:<port>; for example:

      http://9.195.20.121:22 or https://mydomain.fileprovider.com)

      If you don’t specify the port number, the default port 22 is used.

  • Username – A user name required to log in to the SFTP server.
  • Password – A password required to log in to the SFTP server.
  • Host public key – An optional parameter that can be used for additional verification if the SFTP server is configured with a host public key. This key should be in MD5 format.
  • Network name – Used to configure the secure gateway.
SFTP connection. 

Actions supported for files

  • Create file
  • Download file
  • Rename file

Create file

This action can be used to create a file in a folder, and requires three parameters:

  • Type of file – Either ‘text’ or ‘binary’. Select one option from the drop-down list depending on the type of file that needs to be created.
  • Source path – The absolute path of the file (including the file name) that is to be created.
  • File data – Data that needs to be written into the file created.

Download file

This action can be used to download or get the contents of a file in a folder, and requires two parameters:

  • Type of file – Either ‘text’ or ‘binary’. Select one option from the drop-down list depending on the type of file that needs to be downloaded.
  • Source path – The absolute path of the file (including the file name) that needs to be downloaded.

Note: The maximum size of a file that can be downloaded is 10 MB.

Rename file

This action can be used to rename a file in a folder, and requires two parameters:

  • Source path – The absolute path of the file (including the file name) that needs to be renamed.
  • Destination path – The absolute path (including the file name) where the renamed file should be stored.

For example, you can specify the following values to indicate that file sampleFile.txt, which is under the root folder, should be renamed to sampleFile_new.txt.

Source path: /root/sampleFile.txt
Destination path: /root/sampleFile_new.txt

Actions supported for folders

  • Create folder
  • Rename folder

Create folder

This action can be used to create a folder on an SFTP server, and requires one parameter:

  • Source path – The absolute path of the folder (including the folder name) that needs to be created.

Rename folder

This action can be used to rename a folder on an SFTP server, and requires two parameters:

  • Source path – The absolute path of the folder (including the folder name) that needs to be renamed.
  • Destination path – The absolute path of the renamed folder.

For example, you can specify the following values to indicate that folder AppConn, which is under the root folder, should be renamed to AppConnLatest.

Source path: /root/AppConn
Destination path: /root/AppConnLatest

Actions supported for folder items

Retrieve folder items

This action can be used to retrieve the list of items in a folder on an SFTP server. This would give you the list of files and folders (with their metadata) that are present in a folder, and requires one parameter:

  • Parent path – The absolute path of the folder whose list of items are required.

Events supported as triggers for the SFTP node

You can configure the SFTP node to monitor the root or parent folder of an SFTP server, and trigger a flow if a new folder item (folder or file) is created, or if any folder item is updated. If you select the “New or updated Folder item” event, you’ll see the following configuration fields:

SFTP event configuration. 

We suggest that you accept the default values for all fields except for this one:

  • Check for new ‘folderitem’ every (minutes) – Select one of the values from the drop-down list to specify the polling interval in minutes.

Example flow

In the following sample flow, we’ve added an event and actions to read a new file, parse it, create or update contacts in a Salesforce account using the parsed contents, and finally rename the file.

Example SFTP flow. 

The first node is an SFTP event. It triggers the flow whenever there is a new or updated file in the root or parent folder.

SFTP Trigger Node
SFTP event node. 

The second node is configured to download and read the contents of the file that was added or updated. This example uses a comma-separated values (CSV) file, which has a file type of text. We can map the path of the file from the event node.

Download file node. 

For the third node, we’ve added a CSV Parser to parse the contents of the downloaded CSV file.

CSV Parser node.

Next, is a ‘For each’ node containing a Salesforce ‘Update or create contact’ action.

For each node. 

The ‘For each’ node loops through all the records in the CSV file and creates or updates a contact in Salesforce, for each row in the file. Fields are mapped appropriately from the CSV Parser node to create or update a contact.

Salesforce upsert node.

The last node is configured to rename the file on the SFTP server (after the file is downloaded), to symbolize that it has been processed.

SFTP Rename file node.

2 comments on"Introducing the IBM App Connect SFTP node"

  1. jaysun33 March 01, 2018

    What is the format of SFTP service URL?
    I have been provided with domain name e.g. mydaomain.fileprovider.com
    and username and password. I am able to connect from a desktop application but I am unable to connect from App Connect. And I dont see what the error is.

    Reply (Edit)
    • Ian_Larner March 02, 2018

      @jaysun33 Hello
      The format of the SFTP service URL depends on whether you are connecting to a cloud-based SFTP server or an on-premises SFTP server that is in a private network.

      If the connection is to a cloud-based SFTP server, just specify the subdomain that the SFTP provider provides for the respective user account; for example:
      SFTP service URL – mydomain.fileprovider.com

      If the connection is to an on-premises SFTP server that is in a private network, you need to use the IBM Secure Gateway and the SFTP service URL has the following format:
      SFTP service URL – http://: (for example, http://9.195.20.121:22 or https://mydomain.fileprovider.com).

      If you don’t specify the port number, the default port 22 is used.

      P.S. A tutorial is being developed for the SFTP node.

      Regards,
      Ian



#AppConnect
#Cloud
#SFTP