transferSpec contains all of the specifications that you define for your transfer. These specs are passed to the server which uses them for generating the return JSON that allows the action to take place. Below are some examples of the most commonly used setups. For a list of all possible values please see the API docs.
For security reasons, source paths submitted to the Connect API for upload transfers (AW4.Connect#startTransfer) must be obtained either using the showSelectFileDialog/showSelectFolderDialogcalls or setDragDropTargets calls. That's the way to make sure that users are aware of the transfer happening between their host and the remote server.
Similarly, destination paths for downloads must follow the same approach if they are absolute paths (ie. if "use_absolute_destination_path" is set to true in connect_spec JSON).
Note: Aspera Connect does not have an
overwrite boolean-type option (which would allow the user to change the overwrite policy), because each new transfer request overwrites the pre-existing files by default. However, you can back up existing files before they are overwritten; add the value,
"save-before-overwrite": true to the JSON for the
transferSpec before starting the transfer. See Preserving Existing Files Before Download for additional details.
Download a File to the Default Directory
Download a file to the default directory set in the Connect Plugin settings (user defined in settings, or default from installer)
Download a File to a User Defined Directory
Download a file to the directory location that is chosen by the user. You can pass this value in after asking the user. To force the destination directory you also need to use the aspera_connect_settings and enable (true) use_absolute_destination_path. This setting is only used for download operations.
Download a File from a Remote Server which Authorizes Downloads by Token
Tokens are used to have an Aspera server authorize a transfer operation for a given user regarding a given path. The token has to be generated by either the Aspera server or by an entity that has the same knowledge as the Aspera server.
To help generate this token a tool is provided with the server. This tool (astokengen or astokengen.exe) is located in the /bin folder of the Aspera server's root directory. To use this tool you need to specify the following parameters: type (-d), user (-u), and path (-p). For example:
astokengen -u svcAspera -d -p c:/source/file.txt
The command should give you a token which you can place in transferSpec as "token":"value" where value is the value that the operation above generated. You can also have a token generation handled by a web service, which can return the token when you make an AJAX call to it and then you can use that token in your transferSpec.
Fallback to HTTP or HTTPS if SSH Fails
You can fallback to HTTP or HTTPS in the event that SSH fails. In order to enable this you must add http_fallback parameter and set it to true and define the port (default is 80 for HTTP). If you need to use HTTPS you should also enable the cipher parameter and set it to aes-128 and use your HTTPS port. You will also need to enable this in the aspera.conf file on the server
An example of the setting used in aspera.conf is below. For more information please refer to the Aspera Server Documentation.