How to > Transfer Files Using the Copy Service
Transfer Files Using the Copy Service
The Copy service of the ThingWorx File Transfer Subsystem (FTSS) performs file transfers from the ThingWorx Platform to edge clients. You may want to create mashups that allow service technicians to upload application logs from devices for troubleshooting. The Copy service supports file upload requests and file download requests.
Queueable File Transfers
The Copy service takes two parameters that are very important for file transfer jobs that you want to be queueable::
queueable — By default, this parameter is set to false, which means that file transfers are never queued to wait for the asset to contact the ThingWorx Platform. To support clients that are not always connected and ensure that file transfer jobs are queued when clients are not connected, set this property to true. The platform must wait until the clients connect to send messages and process file transfer requests.
* 
To check if an edge client is connected, navigate to the Remote Thing in ThingWorx Composer and check the isConnected and isReporting properties. If the value of either property is true, the edge client is connected and available for a file transfer.
async — This parameter specifies whether the transfer is performed asynchronously (true) or synchronously (false).
* 
Even with queueable set to true, it is possible for a file transfer to fail if the device disconnects during the transfer.
Additional Parameters for the Copy Service
In addition to the queueable and async properties, the Copy service requires the following parameters that specify the source file and path and the destination file, path, and repository:
Parameter
File Download
File Upload
sourceRepo
The ThingName of the File Repository from which the file is downloaded.
The ThingName of the edge device from which to upload the file.
sourceFile
The name of the file to be downloaded to the edge device. For example, test.txt.
The name of the file to be uploaded to the ThingWorx Platform from the edge device.
sourcePath
The path to the file to be downloaded from the File Repository that you specified for the source repository. If this parameter is left blank, the file is assumed to be at the root of the File Repository.
The path to the file on the edge device that you want to upload. If this parameter is left blank, the file is assumed to be at the root of the configured file repository of the edge device.
targetRepo
The ThingName of the edge device to which you want to download the file.
The ThingName of the File Repository to which the file will be uploaded.
targetFile
The name of the file as it should exist on the edge device. If you want to use a different name, you might type successfulTest.txt.
If the file being uploaded is compressed, which is the default behavior, this parameter is ignored.
If a single file is being uploaded uncompressed, this parameter specifies the name of the file as it should exist on the File Repository Thing.
targetPath
The path on the edge device to which the file will be downloaded. For example, /<edge_app_name>/downloads .
If this parameter is left blank, he file is assumed to be at the root of the configured file repository of the edge device.
The path to the file in the File Repository where the file is uploaded.
If this parameter is left blank, the file is uploaded to the root of the File Repository.
Was this helpful?