Copy to FTP Server
Configure copy to FTP Server action handling by specifying URL of the FTP server, Login and password. You can check whether FTP connection is successful by clicking the Test FTP connection button. The Autocreate directories checkbox will create the directory if it was not created on FTP server but specified in the Server path field.
There are two options to export item data on action triggering: text export and file export.
File export option is available for all actions except for Delete. By selecting the file in the File field and specifying the Server path, you configure the action to copy a file from the specified field to the folder on FTP server defined in Server path field.
Starting from version 11.0.0. it is also possible to select the template engine (Encode/Velocity) and specify the output file name. Velocity can be used both for specifying output file name and the content of the text export.
If output file name is not specified, the original file name will be exported.
Example of Output File Name using Velocity template:
${CurrentItem.fieldValue('Metadata')}
For more information about using velocity see Functions and Variables.
Example of using velocity function (foreach) for processing an array of multiple files uploaded to the multiple file fields.
#set($files =${CurrentItem.findFilesInMediaHolder(2492)})
#foreach($file in $files)
$file.toUrlLink(true)
#end
The server path must be specified as an absolute path (with preceding slash /) from the server root, f.e.:
/home/someuser/Files/exported
Text export option is available for all types of actions. Do the following to configure text export:
Select the Text export check box to configure text export on action triggering.
In the Server Path field, specify the path to the folder on FTP server where the text file will be copied to on action triggering.
In the Output format field specify the format of the file that will be exported on action triggering. The following output formats are currently available for selection: xml, html, txt, comma-delimited, tab delimited, custom (starting from version 11.3.0). The default output format for the files is xml, when changing the default format to any other of the above-mentioned extensions information window warns you that after changing the output format, the text entered in the Text File Formatting box will be changed correspondingly. The extension of the output file name will also change in accordance with the selected format. Selecting "Custom format" allows you to enter the extension needed. Note, that "Output File Name" parameter should not contain extension in it's name. Extension is automatically added on file export depending on the selected output format or specified format for the custom one.
Select the encoding for the text from the drop-down box next to the Output format field.
"Template Engine Escape Strategy" configuration option (available from v. 11.3.0) allows to manually define encoding for the file being exported. Configuration options is applicable only to actions using "Encode" template engine, as Velocity provides its own encoding methods. For each format escaping strategy needs to be selected. Available options: "Escape xml", "Escape html". No option selected means no encoding will be applied and data will be exported as is.
Text File Formatting represents the text itself that will be exported. In addition to typing, you can use variables that on action triggering will be replaced by the actual data. The list of variables also includes all fields that are available in the module. All valid variables are listed at the bottom of the Content box.
Note!
For "Delete"-type actions, the following syntax should be used to fetch field values:$CurrentItem.changes().oldValue(yourFieldId)
Enter the name of the file to be exported in the Output file name field. By default, the field is prefilled with the name of the Name field in the module and can be easily overwritten.

Configure Copy to FTP action handling
Copy to File System
Copy to file system action handling copies media and text files to the directories in file system specified in Server path fields in action setup. The setup of the Copy to file system action handling is almost the same as for Copy to FTP server. The only difference between them is that for Copy to File System action handling, you do not specify FTP URL, login and password. All the rest configuration fields are the same. The advantage here is that if you decide to change action handling after all the export fields are configured, the entered data will be saved for all fields that these action handlings have in common.
Configure Copy to File System action handling
To edit an Action, follow these steps:
Click the Edit icon next to the Action that you want to edit.
In the dialog box that opens, modify the Action as necessary.
To delete an Action, click the Edit icon next to it, and then click Delete on the toolbar of the dialog box that opens.
Server Path ConfigurationIt is necessary to keep in mind certain differences when configuring the Server path for “Copy to File System” and “Copy to FTP Server” action handlings.
First, we should distinguish two types of paths: absolute and relative.
The absolute path specifies folder location beginning from the root and always begins with
/
. For example: if we specify the following path:/user
, it means that the file will be placed to theuser
folder which is located under root.The relative path specifies a location in relation to the current location. The current location can be either the place where the worker was started or home directory — place the user logged in from. The latter depends on the server setup. For example, if the current directory on the server is set up as a home directory, the absolute path will be
/home/{user}/folder_name/file.ext
. A relative path will be the following:folder_name/file.ext
.For “Copy to File System” action handling the user can specify either absolute or relative path.
For example:
Absolute path:
/home/{user}/folder_name/file.ext
Relative to current directory:
folder_name/file.ext
When setting up the action with “Copy to FTP Server” action handling, the path should always be absolute.
Copy to HTTP Server
Configured Copy to HTTP Action triggers a request that is sent to the HTTP server. Configuring the action, you can choose between request methods: GET, POST, PATCH,PUT, DELETE.
The action supports HTTP and HTTPS protocols.
Action Settings
Parameter | Description |
Template engine | Encode, Velocity
|
HTTP URL | Request URL that can be processed by the external server. For example:
|
HTTP Method | GET, POST, PATCH, PUT, DELETE |
Authenticate With Connected Service | Enables authentication by selected connected service. Currently the 2 types of the authenticating connected service types are available: - OAuth2 connected service - HTTP Request Headers |
Connected service | Select authenticating connected service |
Content Type | Type of the content to be sent by POST or PUT request methods.
|
Multipart File Parameters | Available when "multipart/form-data" is selected in the Content type selectbox. This allows to configure support of multipart file upload in requests sent in HTTP action. The Source Holder drop down allows to select the Media file holder as a source of file for the request. Both original and custom media holders configured in the module will be available for selection. Please, note! Selecting custom media holder as a file source will not work on new item creation or upload of the new file(s), as previews will not be generated before the action will be triggered which means that the file will not be sent. File Output Name input field allows to specify an alternative filename so that it can be used as a unique key when integrating with 3rd party applications.If the property is empty - original filename is used. Formulas to concatenate file name from few fields are supported. To see examples of velocity functions, please see an article: Functions and Variables As an example:
NOTE: file name is allowed to use for both single and multiple file field
|
Request Body | Used when application/json content type is selected. Specify the valid JSON here. It is possible to use placeholders inside the JSON, so you can send the specific item's data to the server. For example:
Note!
|
Request Parameters | Used when application/x-www-form-urlencoded content type is selected. You can create the pairs "Name-Value" which will be sent as encoded form data. It is possible to use placeholders inside the parameter value
|
Request Headers | Allows adding the "Name-Value" pairs which will be sent as request headers on action triggering. It is possible to use placeholders inside the parameter value. |
Map Response Data | Allows mapping the JSON response to encode fields of the item. "Skip Empty Response" checkbox It allows to control whether empty JSON pointer are returned as warnings or ok to reduce noise on logs
As per version 11.0.0 the following field types are supported in response mapping:
As per version 11.3.0 the following additional field types are supported in response mapping:
It is possible to map the response value to a singe file or multi file field both on existing record ( Update ) and on new record ( Create ). Media Converters can be used for Single file field only. If Version Control is enabled a new version is created each time item is updated. Currently this is only available for Single file fieds. The Mapping works for both 'Encode' and 'Velocity' as Template engine. When file name is not specified on the 'Configuration' field in the Action, then original file name is used as returned by API call.
This enabled the option to set multi-module link fields by string values Checkbox in Configuration for to select 'Map Id' or 'Map Value', is only shown when Field type is ModuleData or CheckBox or MultiSelect or SelectBox or RadioBox or Status.
Example of the Request Body for above: { "ClientsMulti": ["Client 1","Client 2","Client3"], Keywords in Response Path:Using the mapping, it will be easy to check the request status and receive the data. It is possible to use such keywords in Response Path:
Parameters: Starting from version 17:
Version 9.95.0 - 16.0.5:
Before version 9.95.0:
Response Path in versions 16 and earlier: e.g. Response Path from version 17 onward: e.g. Example
From Version 17 onward:
The dot-separated notations are preferable and recommended for usage for properties with simple names. But notations with brackets are safer (for example with property names with dots, or names that contain a lot of characters. It is now possible to extract a property from the last object of json array using the For more details go to the documentation (version 17 and later). Versions 9.95-16.0.5:
Note! Value will not be copied to the target field if Response Path contains character '#', because it's referenced value is the root of the document. For more details go to the documentation (version 16 or earlier). |
Notifications will be sent after HTTP Copy | Field contains a list of Notifications Rules with Sub-Type 'Copy to HTTP Action' created on the site. For more details go to the documentation. |
Note!
Before configuring the HTTP action to send the requests, make sure that your server supports selected HTTP methods.
Also, pay attention to server encoding settings in order to accept Unicode characters that are passed in request correctly. Make sure your server processes requests in UTF-8 encoding.
Starting from v.14.1.0 next logic matrix was implemented for updating files in Single/Universal/Multiple file fields:
Single file field
empty before - new file added
not empty and versions not enabled - clean old file + add new file
not empty and versions enabled - add file with new version
Universal file field(multiple file field with limit=1)
empty before - new file added
not empty versions not enabled - clean old file + add new file
not empty and versions enabled - add file with new version
Multiple file field(limit>1)
empty/not empty - always add new
for ability to clean old file + add new file - added new request param
fd<ID>_clearPreviousFileValues where ID - id of updated file field in target module
for ability to upload file as new version - added new request param
fd<ID>_versionChainId where ID - id of updated file field in target module
Please note: upload of file versions within various chains simultaneously is not supported in one "Copy to HTTP" action.
SortTool in Velocity: Use of SortTool in Velocity is been enabled in version 19. This tool makes it easy to organize and manage lists of items in your templates.
Classes for Debugging
dk.encode.ebms.core.jms.listeners.HttpMessageListener
dk.encode.ebms.connections.service.impl.ConnectedAccountServiceImpl
org.apache.http.wire