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 A published renditions section will be sent in response with preset names and public S3 URLs as keys
 95  * and values respectively if a license for renditions is enabled.
 96  * /wf/restapi/v2/assets
 97  *
 98  * Parameters:
 99  * ids=[201629291]
100  * verbose=true
101  *
102  Response:
103  [
104  {
105 	   "id": 201629291,
106 	   "name": "asset4.xmp",
107 	   "path": "RESTTest/assets/inner/asset4.xmp",
108 	   "height": 1,
109 	   "width": 1,
110 	   "bytes": 4096,
111 	   "lastModified": 1507813578000,
112 	   "mimeType": "application/octet-stream",
113 	   "previews": {
114 		 "thumbnail": "../servlet/jb.view?table=thumbnails&col=thumbnails&id=pe_323031363239323931",
115 		 "viewex": "../servlet/jb.view?table=viewex&col=viewex&id=pe_323031363239323931",
116 		 "downloadUrl": "../servlet/dload?id=pe_323031363239323931"
117 	   },
118 	   "publishedRenditions": {
119             "webPNG": "https://aws-cloud-host-s3Bucket/c1ba4a79-2a82-7823-ab28-5a0a1fa8220a/c1ba4a79-2a82-7823-ab28-5a0a1fa8220a.png",
120             "webJpeg": "https://aws-cloud-host-s3Bucket/9ff45e98-dcc0-7823-9e45-c3be6390d3bf/9ff45e98-dcc0-7823-9e45-c3be6390d3bf.jpeg",
121             "webGif": "https://aws-cloud-host-s3Bucket/11a081b2-53cf-7823-bb08-2a7f75c4ccee/11a081b2-53cf-7823-bb08-2a7f75c4ccee.gif"
122        }
123 	 }
124  ]
125 
126  @example /wf/restapi/v2/assets
127 
128  Parameters:
129  ids=[201629291]
130  fields=["http://ns.mediabeacon.com/datablock/1.0/ datablock"]
131 
132  Response:
133  [
134  {
135         "id": 201633049,
136         "fields": {
137             "http://ns.mediabeacon.com/datablock/1.0/ datablock": [
138                 {
139                     "http://ns.adobe.com/pdf/1.3/ Keywords": "datablock0"
140                 }
141             ]
142         }
143     }
144  ]
145 
146  */
147 function main() {
148 	REST.setCallback(assetInfo);
149 	return REST.execute();
150 }
151 main();