Advanced SFTP V2 Connector > File transfer > receivefiles
  

receivefiles

Use the receivefiles resource to get files from a remote server.
The following connection types use the receivefiles resource to transfer files to the remote server:
Before you construct a receivefiles request to receive files, obtain the identifier of the connection that provides access to the server. To get the connection ID, you can send a GET request using the connection resource. The connection resource can return information for each of your organization's connections.

POST Request

To receive files, include the connection ID in the following URI.
mftsaas/api/v1/receivefiles/<connection ID>
Include the following information in the request:
Field
Type
Required
Description
sourceConnectionType
String
Yes
Connection type.
The supported source connection types are:
  • - Advanced FTP V2
  • - Advanced FTPS V2
  • - Advanced SFTP V2
tgtDirectoryPath
String
Yes
Directory path to where files are transferred.
srcDirectoryPath
String
-
Directory path from where files are transferred.
Default is '/'.
srcFilePattern
String
Yes
Source file name pattern. Specify a file name pattern to identify which files to send. You can use the regular expression type.
processFilesRecursively
String
-
Whether to process files from all sub-folders within the base directory. Default is false.
afterFilePickupAction
String
-
Determines what to do with source files after the files transfer. The following options are available:
  • - Keep the files in the source directory.
  • - Delete the files from the source directory.
  • - Rename the files in the source directory. You must specify a file name suffix that adds to the file name when renaming the files.
  • - Archive the files to a different location. You must specify an archive directory.
Default is KEEP.
skipDuplicateFiles
String
-
Do not transfer duplicate files. If files with the same name and creation date were transferred, the task does not transfer them again, and the files are marked as duplicate in the job log. If this option is not selected the task transfers all files.
Default is false.
whenFileExists
String
-
Determines what to do with a file if a flat file with the same name exists in the target directory. The following options are available:
  • - rename
  • - overwrite
  • - skip
  • - stop
  • - error
Default is rename.
For example, to transfer the files with ".txt" pattern, and rename the file if a flat file with same name exists in the target directory, you might use the following request:
POST <serverUrl>/mftsaas/api/v1/sendfiles/<connection ID>
Accept:application/json
IDS-SESSION-ID: <icSessionId or INFA-SESSION-ID>
{
"sourceConnectionType": "Advanced SFTP V2",
"tgtDirectoryPath": "C:\\docstoreLocal2",
"srcDirectoryPath": "C:\\server\\userdata\\workspace",
"srcFilePattern": ".*txt“,
"processFilesRecursively": false,
"afterFilePickupAction": "KEEP",
"skipDuplicateFiles": false,
"whenFileExists": "rename",
}

POST Response

If successful, Informatica Intelligent Cloud Services returns the run ID for the job. Use the run ID to monitor the job status.
The following example shows a successful response:
{
"projectId": 0,
"timeTaken": 0,
"queuePriority": 0,
"runPriority": 0,
"runMode": "UNKNOWN",
"submitSourceId": -1,
"correlationId": "OWMxOTc2YjktNzI4YS00Mm",
"runModeInteractive": false,
"runModeBatch": false,
"runModeDebug": false,
"runModeUnknown": true,
"formattedTimeTaken": "0.00",
"id": 1000000000384,
"runId": 385
}
If unsuccessful, the response includes a reason for the failure.