HTTP Track Create


Required Fields


source
The path to the source Flow.
destination
A list of possible destination Flows.

Optional Fields


filter
Filter statement, used to denote elements and values of a Drop added to the source Flow which are required to "activate" the Track. If unspecified, all drops incoming to the source Flow will activate the Track.
js
A javascript function that takes a Drop matching the filter from the source Flow as its first argument and then returns a Drop to be written to the destination Flow. The API may be accessed from within the js in order to enhance Drops with data from other Flows by utilizing Flow.js

Request


POST https://api.flowthings.io/v0.1/<account_id>/track

Headers

NameDescription
Content-Typeapplication/json
X-Auth-TokenAuthentication Token

Example

  {
    "source" : "/bob/my_source",
    "destination" : ["/bob/my_destination"],
    "filter" : "elems.rating > 25",
    "js" : "function f(input) {
                     var output = input;
                     output.elems['stars'] = {
                       'type' : 'float',
                       'value' : input.elems['rating'].value/25
                     };
                     delete output.elems['rating'];
                     return {
                       '/bob/my_destination': [output]
                     }
                 }"
  }

Response


HTTP Codes

CodeDescription
201Resource Created
400Bad Request
401Unauthorized
503Service Unavailable

Example Response Body

  {
    "head": {
      "status": 201,
      "ok": true,
      "errors": [],
      "messages": [ "Your request has been processed successfully. A new resource has been created." ]
    },
    "body": {
      "id": "t53b1d1600cf27b75148de02e",
      "source" : "/bob/my_source",
      "destination" : "/bob/my_destination",
      "filter" : "elems.rating > 25",
      "js" : "function f(input) { var output = input; output.elems['stars'] = {'type' : 'float', 'value' : input.elems['rating'].value/25 }; delete output.elems['rating']; return { '/bob/my_destination': [output] }; }"
    }
  }