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

The response will look something like this

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

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 Oct 02 2015 17:09:28 GMT-0500 (CDT)