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 lets Zato services access an FTP server, using plain FTP or FTPS. Services obtain connections 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 uses 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 let Zato monitor a directory on this server.