In this article, I would like to present a method for downloading a file (asset) associated with a Task in SDL WorldServer using the REST API.

The method takes six parameters:

  1. wsBaseUrl
  2. token
  3. taskId
  4. assetName
  5. downloadLocation
  6. assetLocationType

The wsBaseUrl must be the <serverURL>:<portnumber> where your WorldServer instance is running.

The second parameter is a security token, which can be retrieved by using the SDL WorldServer REST API as explained here.

The third parameter is the id of the Task in SDL WorldServer to download the asset from.

The fourth parameter is the name of the asset to download. This can be retrieved by invoking the REST call described here for retrieving the tasks from a specified Project. The returned TaskDetails object provides the targetAsset attribute containing the path to the target asset. Use this path to work out the file (asset) name.

The firth parameter is the path to the download location where to place the downloaded file.

Finally the sixth parameter is used to determine the location type: SOURCE, TARGET or SOURCE_TARGET.

The method returns a String containing the path to the downloaded file.

Click here to view the source code

Anonymous