Outgoing FTP and FTPS connections
Host, port, credentials and FTPS for plain FTP servers, with the same API as SFTP and SMB.
An outgoing FTP connection is how a Zato service reaches an FTP server, in plain FTP or in FTPS. Services look connections up by the name given here.
In Dashboard, go to Connections → Outgoing → FTP and click Create.
The fields:
| Name | Notes |
|---|---|
| Name | The name of the connection, as used in your services |
| Use SSL (FTPS) | Whether the connection speaks FTPS - FTP over TLS |
| Host | The remote server's host |
| Port | The remote server's port, with a default of 21 |
| Username | The username to log in with |
| Password | The password to log in with |
| Store file contents | Whether the audit log keeps the bytes of each transferred file, in addition to the always-recorded metadata |
| Verify stores by | How an upload is confirmed - Size compares the size of the remote file with what was sent, Read back reads the whole file back and compares its bytes |
Paths
Remote paths are relative to the account's root directory and use forward slashes:
The same goes for the directory a schedule is given.
What you can do with the connection
Once the connection exists, a service reaches it through self.ftp:
from zato.server.service import Service
class MyService(Service):
def handle(self):
conn = self.ftp['My FTP Connection']
# The file's contents
data = conn.read('incoming/orders.csv')
The connection API lists every method and its arguments - reading, writing, uploading, listing, moving and deleting. You can also run commands with conn.execute, one per line - ls, stat, exists, mkdir, rmdir, rm, mv, cat and ping, the same ones the FTP command shell in Dashboard offers.
File transfer schedules have Zato watch a directory on this server for you.