1 /**
  2  * Workflow to return the Path of the (asset/assets) given a list of asset Id's using a REST call
  3  *
  4  */
  5 var REST = library.REST.REST();
  6 var myData = {};
  7 
  8 /**
  9  * Creates a JSON object with the path of the given asset and adds it to myData
 10  * @param theAssetId
 11  */
 12 function assetIdToPath(theAssetId) {
 13   var aFile = fileManager.getFileObjectById(theAssetId);
 14   myData[theAssetId] = aFile.path;
 15 }
 16 
 17 /**
 18  * Returns the path of assets based on their assetIDs.
 19  * @description  Locates assets by the list of AssetIDs in 'src' and returns their path values. These values are parsed
 20  * into a text object keyed by AssetID from the JSON file in which they are contained, and by default are displayed to
 21  * the user.
 22  * @example 'MBurl'/wf/restapi/1/assetIdToPath?src=["AssetID"]
 23  * @example <a target="_blank" href=http://127.0.0.1:55555/wf/restapi/1/assetIdToPath?src=["12345"]>http://127.0.0.1:55555/wf/restapi/1/assetIdToPath?src=["12345"]</a>
 24  * @class Returns the path of assets based on their assetIDs.
 25  * @name AssetIdToPath
 26  * @param src AssetID/list of assetIDs to get the paths from.
 27  * @returns ( {'AssetID': "path",...} )
 28  */
 29 function main() {
 30   var aParameters = REST.getParametersToIterate("src");
 31   if (myData.error != null) {
 32     return REST.formatResponse();
 33   }
 34   REST.iterateThroughParameters(aParameters, assetIdToPath);
 35   return REST.formatResponse();
 36 }
 37 main();
 38