1 /**
  2  * @name An_Intro_To_REST
  3  * @class
  4  <html>
  5  <head>
  6  <meta content="text/html; charset=utf-8" http-equiv="content-type">
  7  <style type="text/css">
  8  ol{margin:0;padding:0}
  9  .c0{orphans:2;text-indent:36pt;widows:2;direction:ltr}
 10  .c1{orphans:2;widows:2;direction:ltr;height:11pt}
 11  .c15{background-color:#ffffff;max-width:80%;padding:72pt 72pt 72pt 72pt}
 12  .c5{orphans:2;widows:2;direction:ltr}
 13  .c9{padding:0;margin:0}
 14  .c10{margin-left:36pt}
 15  .c12{padding-left:0pt}
 16  .c6{font-style:italic}
 17  .c8{height:11pt}
 18  .c11{margin-right:9pt}
 19  .c7{margin-left:108pt}
 20  .c4{font-weight:bold}
 21  .c13{font-size:18pt}
 22  .c2{font-size:12pt}
 23  .c14{text-align:center}
 24  .c3{margin-left:72pt}
 25  .code{font-size:11pt}
 26  .title{padding-top:0pt;color:#000000;font-size:26pt;padding-bottom:3pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}
 27  .subtitle{padding-top:0pt;color:#666666;font-size:15pt;padding-bottom:16pt;font-family:"Arial";line-height:1.15;page-break-after:avoid;orphans:2;widows:2;text-align:left}
 28  li{color:#000000;font-size:11pt;font-family:"Arial"}
 29  p{font-size:18px;font-family: HelveticaNeue-Light, Arial, Helvetica, sans-serif;}
 30 
 31  </style>
 32 
 33  <title></title>
 34  </head>
 35  <meta content="text/html; charset=utf-8" http-equiv="content-type">
 36 
 37  <title></title>
 38  </head>
 39 
 40  <body class="c15">
 41 
 42  <p class="c5 c14"><span class="c13">REST Quick Start Guide</span></p>
 43 
 44  <p class="c1 c14"><span></span></p>
 45 
 46  <p class="c1 c14"><span></span></p>
 47 
 48  <p class="c5"><span>The basic structure to execute each REST
 49  workflow is</span></p>
 50 
 51 
 52  <p class="c0"><span class=
 53  "c6 c2"><MBUrl>/wf/restapi/1/<theWorkflowName>?<param1>=<value1>&<param2>=<value2></span></p>
 54 
 55 
 56  <p class="c5"><span>For example, if you wanted to create a new folder named
 57  “TestRest” you could run</span></p>
 58 
 59 
 60  <p class="c0"><span class=
 61  "c6 c2">http://127.0.0.1:55555/wf/restapi/1/create?src=TestRest</span></p>
 62 
 63 
 64  <p class="c5"><span>To create multiple folders or files replace TestRest
 65  from above with an array of paths the JavaScript array format.</span></p>
 66 
 67 
 68  <p class="c0"><span class=
 69  "c6 c2">http://127.0.0.1:55555/wf/restapi/1/create?src=["TestRest/test.txt",
 70  "AnotherFolder/SubFolder"]</span></p>
 71 
 72 
 73  <p class="c5"><span>Most workflows will return a JSON object once the
 74  Workflow has finished executing.   The general format is</span></p>
 75 
 76  <p>
 77  <code class="code">
 78   {<br>
 79     	  "<aKey>":
 80    		"<aValue>"<br>
 81     	 }
 82  </code>
 83  </p>
 84 
 85 
 86 
 87  <p class="c5"><span>The Create Workflow above would have a response like
 88  this</span></p>
 89 
 90  <p>
 91  <code class="code">
 92   {<br>
 93     	  "200096905":
 94    		"TestRest/test.txt",<br>
 95     	  "AnotherFolder/SubFolder":
 96    		"AnotherFolder/SubFolder"<br>
 97     	 }
 98  </code>
 99  </p>
100 
101 
102  <p class="c5"><span>Any errors that may occur will be keyed by the value
103  “error”</span></p>
104 
105  <p>
106  <code class="code">
107   {<br>
108     	  "error":<br>
109     	   {<br>
110     	    "AnotherFolder/SubFolder/":
111    		"Folder already exists"<br>
112    		   }<br>
113     	 }
114  </code>
115  </p>
116 
117 
118 
119  <p class="c5"><span class="c4">Api Key</span><span> </span></p>
120 
121  <p class="c5"><span>Adding the parameter apikey=<theKey> to any REST
122  workflow will allow you to trigger the workflow without logging in to
123  MediaBeacon.  For example,</span></p>
124 
125 
126 
127  <p class="c0"><span class=
128  "c6 c2">http://127.0.0.1:55555/wf/restapi/1/create?src=TestRest&apikey=A3C14EE3-B724-420C-B598-24BC3686844</span></p>
129 
130 
131  <p class="c5"><span>An api key can be created by executing the getApiKey Workflow.</span></p>
132 
133  <p class="c0"><span class=
134  "c6 c2">http://127.0.0.1:55555/wf/restapi/1/getApiKey?src=["Bob",
135  "Larry"]&expires=false</span></p>
136 
137  <p class="c5"><span>Alternatively, if you don't have a valid session or exising API key, user and password params can be used.  Using user/password directly to call workflows
138  is not recommended passed the initial API key creation.</span></p>
139 
140  <p class="c0"><span class=
141  "c6 c2">http://127.0.0.1:55555/wf/restapi/1/getApiKey?user=root&pass=test&src=["Bob",
142  "Larry"]&expires=false</span></p>
143 
144  <p class="c5"><span>The response will look something like this</span></p>
145  <p>
146  <code class="code">
147   {<br>
148     	  "Bob":
149    		"A3C14EE3-B724-420C-B598-24BC3686844C",<br>
150     	  "Larry":
151    		"421FDB14-342F-4ED4-9DC7-E80921AB8434"<br>
152     	 }
153  </code>
154  </p>
155 
156  <p class="c5"><span>Finally, there is one other authentication option available, HTTP basic auth <a target="_blank" href=https://en.wikipedia.org/wiki/Basic_access_authentication>Wikipedia</a>.</span></p>
157 
158  <p class="c5"><span class="c4">Upload</span></p>
159 
160  <p class="c5"><span>To upload a file to MediaBeacon via REST the file needs
161  to be added to the body of the POST.  The best way to test this is to
162  download a REST client.  There is a free app you can install in Google
163  Chrome called Postman that works well.  In theses clients you would
164  input a URL in the same way as the examples above.  </span></p>
165 
166 
167  <p class="c5"><span class=
168  "c6 c2">http://127.0.0.1:55555/wf/restapi/1/upload?dest=/TestUpload&apikey=CB72661B-FB65-4ADB-BDD3-BD2C82C56120</span></p>
169 
170 
171  <p class="c5"><span>To add the file to the body of the POST most REST
172  clients will have an option to choose a file.</span></p>
173 
174 
175  <p class="c5"><span class="c4">Usage Examples</span></p>
176 
177 
178  <p class="c5"><span>File Download</span></p>
179 
180  <ul class="c9 lst-kix_hv3qygwbefbd-0 start">
181  <li class="c5 c10 c12"><span class=
182  "c6 c2">http://127.0.0.1:55555/wf/restapi/1/download?src=<AssetID></span></li>
183  </ul>
184 
185  <p class="c5"><span>File Move</span></p>
186 
187  <ul class="c9 lst-kix_h1da3dpe7bt6-0 start">
188  <li class="c5 c10 c12"><span class=
189  "c6 c2">http://127.0.0.1:55555/wf/restapi/1/move?src=[<AssetID>,
190  <AssetID2>]&dest='<NewFolderPath>'</span></li>
191  </ul>
192 
193  <ul class="c9 lst-kix_h1da3dpe7bt6-1 start">
194  <li class="c5 c12 c3"><span>Moves assets with the given asset
195  id’s to a folder with the NewFolderPath</span></li>
196  </ul>
197  </body>
198  </html>
199  */
200 function main() {}
201 main();
202