AS2 Connector > Sending AS2 files > File transfer using REST API resources
  

File transfer using REST API resources

To send files to an AS2 server, you can use the Informatica Intelligent Cloud Services REST API. To use the REST API, you must be assigned the Admin user role.
Use the following REST API resources to send AS2 files:
connection resource
Use the connection resource to get the ID of the AS2 connection that provides access to the AS2 server. For information about the connection resource, see the "Data Integration REST API Resources" section in REST API Reference.
sendfiles resource
Use the sendfiles resource to send the files to the AS2 server. Include the AS2 connection ID in the request. For information about the sendfiles resource, see sendfiles or the "Data Integration REST API Resources" section in REST API Reference.
To monitor file transfers that you initiate through the REST API, you can use the job REST API resource or you can use the Informatica Intelligent Cloud Services Monitor service.
For more information, see Monitoring AS2 file transfers.

sendfiles

Use the sendfiles resource to transfer files to a remote server.
Before you construct a sendfiles request to transfer AS2 files, obtain the identifier of the AS2 connection that provides access to the AS2 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 transfer files, include the connection ID in the following URI.
mftsaas/api/v1/sendfiles/<connection ID>
Include the following information in the request:
Field
Type
Required
Description
targetConnectionType
String
Yes
Connection type. To transfer files to an AS2 server, specify "as2".
srcDirectoryPath
String
Yes
Directory path to the files you want to transfer.
srcFilePattern
String
Yes
Source file name pattern. Specify a file name pattern to identify which files to send. You can use the asterisk (*) wildcard in the file name pattern.
deleteSourceFiles
String
-
Whether to delete source files after a successful POST request. Use one of the following values:
  • - true. Delete source files.
  • - false. Save source files.
Default is true.
For example, to transfer the files that begin with "file_" that are located in the workspace 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>
{
"targetConnectionType": "as2",
"srcDirectoryPath": "C:\\server\\userdata\\workspace",
"srcFilePattern": "file_*“
}

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.