Class Index | File Index

Classes


Class An_Intro_To_REST

REST Quick Start Guide

The basic structure to execute each REST workflow is

<MBUrl>/wf/<theWorkflowName>?<param1>=<value1>&<param2>=<value2>

For example, if you wanted to create a new folder named “TestRest” you could run

http://127.0.0.1:55555/wf/create?src=TestRest

To create multiple folders or files replace TestRest from above with an array of paths the JavaScript array format.

http://127.0.0.1:55555/wf/create?src=["TestRest/test.txt", "AnotherFolder/SubFolder"]

Most workflows will return a JSON object once the Workflow has finished executing.   The general format is

 {
  "<aKey>": "<aValue>"
 }

The Create Workflow above would have a response like this

 {
  "200096905": "TestRest/test.txt",
  "AnotherFolder/SubFolder": "AnotherFolder/SubFolder"
 }

Any errors that may occur will be keyed by the value “error”

 {
  "error":
   {
    "AnotherFolder/SubFolder/": "Folder already exists"
   }
 }

Api Key 

Adding the parameter apikey=<theKey> to any REST workflow will allow you to trigger the workflow without logging in to MediaBeacon.  For example,

http://127.0.0.1:55555/wf/create?src=TestRest&apikey=A3C14EE3-B724-420C-B598-24BC3686844

An api key can be created by executing the getApiKey Workflow.

http://127.0.0.1:55555/wf/getApiKey?src=["Bob", "Larry"]&expires=false

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 is not recommended passed the initial API key creation.

http://127.0.0.1:55555/wf/getApiKey?user=root&pass=test&src=["Bob", "Larry"]&expires=false

The response will look something like this

 {
  "Bob": "A3C14EE3-B724-420C-B598-24BC3686844C",
  "Larry": "421FDB14-342F-4ED4-9DC7-E80921AB8434"
 }

Finally, there is one other authentication option available, HTTP basic auth Wikipedia.

Upload

To upload a file to MediaBeacon via REST the file needs to be added to the body of the POST.  The best way to test this is to download a REST client.  There is a free app you can install in Google Chrome called Postman that works well.  In theses clients you would input a URL in the same way as the examples above.  

http://127.0.0.1:55555/wf/upload?dest=/TestUpload&apikey=CB72661B-FB65-4ADB-BDD3-BD2C82C56120

To add the file to the body of the POST most REST clients will have an option to choose a file.

Usage Examples

File Download

File Move


Defined in: An Intro to REST.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Class Detail
An_Intro_To_REST()

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 30 2016 13:29:19 GMT-0500 (CDT)