Example Use Cases

Version 20.0.7580


Example Use Cases


This section contains common use cases that require a combination of API requests to accomplish.

Insert a File into the Workflow

POSTing to the Files Resource adds a file to the ‘Send’, ‘Receive’, or ‘Sent’ folder for a particular connector. To insert a file into the workflow, POST the file to the ‘Send’ folder for the first connector that should process the file. For example:

POST http://mydomain.com:8001.com/api.rsc/files
{
    "ConnectorId":"myConnector",
    "Folder":"Send",
    "Filename":"test.txt",
    "Content":"VGhpcyBpcyBhIHRlc3Qu"
}

Note that the ‘Content’ parameter includes the base64-encoded content of the file.

If the target connector has Send Automation enabled then the file will automatically be processed. Otherwise, an additional call to the sendFile Action is required to instruct the connector to process the file. For example:

POST http://mydomain.com:8001/api.rsc/sendFile
{
  "ConnectorId":"myConnector",
  "File":"test.txt"
}

Retrieve the Log File for a Specific Transaction

The getTransactionLogs Action retrieves the log file for a specific action. Invoking this Action requires knowing the MessageId for the relevant transaction. The MessageId can be found by querying the Transactions Resource first (the Transactions Resource returns metadata about the transaction, but not the transaction log file itself).

The GET query to the Transactions Resource should include any filters necessary to identify the specific transaction (unless the result set can be parsed by some other process to find the MessageId for the desired transaction), for example:

GET http://mydomain.com:8001/api.rsc/transactions(connectorId='myAS2Connector',Filename='myFile.edi')

The JSON body of the response will include the MessageId for the specific transaction. Use this MessageId in the getTransactionLogs call, along with the other required parameters ‘ConnectorId’ and ‘Direction’ (Send or Receive). The ‘Include Content’ parameter should be set to ‘True’ to include the contents of the log file in the response. For example:

POST http://mydomain.com:8001/api.rsc/getTransactionLogs
{
	"ConnectorId":"myConnector",
	"Direction":"Send",
	"MessageId":"message_id_from_earlier",
	"IncludeContent":"True"
}

The ‘Content’ parameter of the response will hold the base64-encoded log file contents.