1 var REST = library.REST.REST();
  2 
  3 /**
  4  * A callback that just pushes the managed file into the response object
  5  * @param theAssetId
  6  */
  7 function assetInfo(theManagedFile) {
  8   if (!!theManagedFile) {
  9     REST.push(theManagedFile, {}, true);
 10   }
 11 }
 12 
 13 /**
 14  * @name Assets
 15  * @class Collects assets data
 16  * @description  Given a resolver URL or an array of Id's, this endpoint returns asset data for each asset
 17  * @param [ids] The asset id's
 18  * @param [resolver] A resolver url
 19  * @param [verbose=false] Setting this to true will collect a variety of default values for each asset.
 20  * @param [FILTERS] Filtering can be applied to the "id", "name", "path", "height", "width", "bytes", "lastModified", "mimeType", and "resolver" properties if verbose=true.
 21  * @param [fields] An array of field id's to collect the values for each asset
 22  * @returns [{assetInfo}, ... ]
 23  *
 24  * @example /wf/restapi/v2/assets
 25  *
 26  * Parameters:
 27  * ids=[201629291]
 28  *
 29  Response:
 30  [
 31 	 {
 32 	   "id": 201629291
 33 	 }
 34  ]
 35  * @example /wf/restapi/v2/assets
 36  *
 37  * Parameters:
 38  * ids=[201629291,201629290]
 39  *
 40  Response:
 41  [
 42 	 {
 43 	   "id": 201629291
 44 	 },
 45 	 {
 46 	   "id": 201629290
 47 	 }
 48  ]
 49  * @example /wf/restapi/v2/assets
 50  *
 51  * Parameters:
 52  * resolver=directory://237
 53  *
 54  Response:
 55  [
 56 	 {
 57 	   "id": 201629290
 58 	 },
 59 	 {
 60 	   "id": 201629291
 61 	 }
 62  ]
 63  * @example /wf/restapi/v2/assets get the users current selection
 64  *
 65  * Parameters:
 66  * resolver=currentSelection://-1
 67  *
 68  Response:
 69  [
 70  {
 71      "id": 201629292
 72    }
 73  ]
 74  * @example /wf/restapi/v2/assets
 75  *
 76  * Parameters:
 77  * ids=[201629291]
 78  * fields=["http://purl.org/dc/elements/1.1/ title","http://purl.org/dc/elements/1.1/ subject"]
 79  *
 80  Response:
 81  [
 82 	 {
 83 	   "id": 201629291,
 84 	   "fields": {
 85 		 "http://purl.org/dc/elements/1.1/ title": "DC title field",
 86 		 "http://purl.org/dc/elements/1.1/ subject": [
 87 		   "check",
 88 		   "1",
 89 		   "2"
 90 		 ]
 91 	   }
 92 	 }
 93  ]
 94  * @example /wf/restapi/v2/assets
 95  *
 96  * Parameters:
 97  * ids=[201629291]
 98  * verbose=true
 99  *
100  Response:
101  [
102 	 {
103 	   "id": 201629291,
104 	   "name": "asset4.xmp",
105 	   "path": "RESTTest/assets/inner/asset4.xmp",
106 	   "height": 1,
107 	   "width": 1,
108 	   "bytes": 4096,
109 	   "lastModified": 1507813578000,
110 	   "mimeType": "application/octet-stream",
111 	   "previews": {
112 		 "thumbnail": "../servlet/jb.view?table=thumbnails&col=thumbnails&id=pe_323031363239323931",
113 		 "viewex": "../servlet/jb.view?table=viewex&col=viewex&id=pe_323031363239323931",
114 		 "downloadUrl": "../servlet/dload?id=pe_323031363239323931"
115 	   }
116 	 }
117  ]
118 
119  */
120 function main() {
121   REST.setCallback(assetInfo);
122   return REST.execute();
123 }
124 main();
125