Using FTPClient to Integrate Backend Systems

Salesforce B2C Commerce implements an FTP client in the B2C Commerce Script API to enable developers to access remote locations via the FTP protocol. The FTPClient class can be used to pull or push files that don't need to be transmitted securely. Because it isn't a secure transfer protocol, Commerce Cloud recommends that you use the FTPClient only for sandboxes.

The FTPClient class supports the FTP commands CD, GET, PUT, DEL, MKDIR, RENAME, and LIST. Because the RMD command isn't supported, it isn't possible to delete directories using the B2C Commerce FTP client.

The FTP connection is established using passive transfer mode (PASV). The transfer of files can be text or binary.
Note: The FTPClient.setTimeout method sets the socket, data channel, and script timeouts for the FTP call. Each timeout is set to this value, so the total timeout might be longer than the value set.
The following is an example:
var ftp : FTPClient = new;
ftp.connect("", "username", "password");
var data : String = ftp.get("simple.txt");
If you want to use the FTPClient class, you must contact Commerce Cloud Support to have a firewall rule installed. Include the following information in your support case: