Supported Commands
Supported Commands
Supported Commands using FTP2SF:
-
Get: Retrieves the contents of a file from the Service
- Syntax:
FTP2SF.FTP.get(string Site, string FilePath); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • Filepath - The file path to fetch the file contents from.
- • Returns: a Blob containing the content of the file.
- Syntax:
-
Put: Writes the content of the specified Blob to the filepath on the Service.
- Syntax:
FTP2SF.FTP.put(string Site, string FilePath, blob content); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • FilePath - The file path to create a new file.
- • Content - The blob content to write to the newly created file.
- • Returns: a File reference containing information about the written file.
- Syntax:
-
Ren: Performs a rename of the file on the Service.
- Syntax:
FTP2SF.FTP.ren(string Site, string oldPath, string newPath); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • OldPath - The file path including the file name which you want to rename.
- • NewPath - The new file name.
- • Returns: a Response indicating success or failure.
Note: Azure Blob, AWS S3 & DropBox will maintain backup copies if configured to do so, refer to your service specific guidelines for clarification
- Syntax:
-
Del: Deletes a file from the service
- Syntax:
FTP2SF.FTP.del(string Site, string FilePath); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • FilePath - The file path to delete the file.
- • Returns: a Response indicating success or failure.
Note: Azure Blob, AWS S3 & DropBox will maintain backup copies if configured to do so, refer to your service specific guidelines for clarification
- Syntax:
-
Find: Performs a file lisiting (ls or dir) on the service
- Syntax:
FTP2SF.FTP.find(string Site, string FolderPath); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • FolderPath - The directory/folder from where you want to fetch all the files details.
- • Returns: a Find listing containing a collection of File information and attributes within the items
Note: Azure Blob & AWS S3 Treat path seperators (/ and \) as a filename character not a path seperator, refer to your service specific guidelines for clarification. In addition your service type may require posix style seperators / or windows style \ this may also require escaping your file path eg \\. In general you should not include a leading path character as each service type may have specific implementation differences.
- Syntax:
-
Mkdir: Creates a directory structure on the service.
- Syntax:
FTP2SF.FTP.mkdir(string Site, string FilePath); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • FilePath - The file path to create a new folder including the folder name.
- • Returns: a Response indicating success or failure.
Note: Azure Blob & AWS S3 Treat path seperators (/ and \) as a filename character not a path seperator, refer to your service specific guidelines for clarification
- Syntax:
-
Rmdir: Renames the file or folder on the service.
- Syntax:
FTP2SF.FTP.rmdir(string Site, string FilePath); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • FilePath - The file path to delete from the server including the folder name.
- • Returns: a Response indicating success or failure.
Note: Azure Blob, AWS S3 & DropBox will maintain backup copies if configured to do so, refer to your service specific guidelines for clarification
- Syntax:
-
Exists: Confirms if a file exists on the service.
- Syntax:
FTP2SF.FTP.exists(string Site, string FilePath); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • FilePath - The file path to check if it exists.
- • Returns: a Response indicating success or failure.
- Syntax:
-
Ping: Performs a connection request to the service.
- Syntax:
FTP2SF.FTP.ping (string Site, integer timeout); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • Timeout - Timeout for the callout in seconds.
- • Returns: a Response indicating success or failure.
Note: The ping function performs an end to end request including a login to the specified service, it does not validate the ability to read or write to the service, to validate you have the required permissions to READ perform a Find operation and then GET operation as services may provide granular permissions (list but not read), likewise to confirm WRITE access PUT operation.
- Syntax:
Extended Commands using FTP2SF:
The following commands utilise FTP2SF custom functions that extend the underlying service response. If you are unsure as to the use of these functions please contact support for assistance.
-
Append: Adds the specfied content to the end of the file on the service.
- Syntax:
FTP2SF.FTP.append(String Site, String filePath, Blob content); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • FilePath - The file path to put the contents to.
- • Content - The contents to be appended to the file.
- • Returns: a Response indicating success or failure.
Note: This function allows for writing data or files that exceeds the Salesforce limit for callouts of 6MB. SFTP and FTPS servers do not support an append function nativley, to accomplish an append operation these services perform a full in-memory read to end-of-file and then a full write including the specified content - this can result in signifcant performance and traffic overhead.
- Syntax:
-
Trn: Transfers data from one file service to another.
- Syntax:
FTP2SF.FTP.trn(string fromSite,string fromFilePath, string toSite, string toFilePath); - • FromSite - The name given to your file service during FTP2SF site registration, from where you want to transfer data – source server.
- • FromFilePath - The file path to fetch the file contents from the source service.
- • ToSite - The name given to your file service during FTP2SF site registration, to where you want to transfer data – destination server.
- • ToFilePath - The file path on the destination server to store the file contents retrieved from the source server.
- • Returns: a Response indicating success or failure.
Note: This function performs an in-memory read and write to the specified services, no data is read to your Salesforce instance and only success or failure of the operation is returned.
- Syntax:
-
Rtr: Used to retrieve the file contents from a service to a SF org that is over 6MB.
- Syntax:
FTP2SF.FTP.Rtr(string Site,string filePath,string requestId,string terminator,integer maxSize); - • Where: Site - The name given to your file service, entered during FTP2SF site registration.
- • FilePath - File path from where you want to fetch all file details.
- • RequestId – Unique Id to identify the request and response.
- • Terminator – Terminator character to be used.
- • MaxSize – The maximum byte size used for retrieving the content.
- • Returns: a Response indicating success or failure.
Note: This function performs an in-memory read and subsequent callback to your Salesforce instance, to support this function you must write a callback class that implements a REST service that can be called for each "chunk" of the file data.
- Syntax: