Push Data

The Leftronic Custom Data API uses HTTP POSTs to push data formatted according to the Leftronic Data Format to custom streams.

Start by setting up custom widgets on your dashboard by choosing “Custom Data” from the data service panel, selecting “Push Data”, and then choosing from the family of widgets. Click on the small gear icon in the upper right hand corner of the widget and select “Edit Widget Settings” to configure your widget.

In the “Data Settings” tab, a unique “Stream Name” is automatically created, but if you prefer you can also enter your own unique stream name. Click “Save” to save your changes.

  • Pushing a single data point to a single stream
  • Pushing multiple data points to a single stream
  • Pushing to multiple streams
  • Clearing a widget

Pushing a single data point to a single stream:

Each POST should include your accessKey, the streamName of the widget that you will be pushing data to, and a point which contains the payload data, formatted according to the Leftronic Data Format.

Note that the widget type and the data format must match up. For example, when pushing data to a map widget, the data must be formatted according to the Map format and not according to the Leaderboard format.

For example, to push data to a map widget with stream name myMap, you could POST the following JSON string to https://www.leftronic.com/customSend/:{"accessKey": "bGVmdHJvbmljaXNhd2Vz",

"streamName": "myMap",
"point": {"latitude": 34, "longitude": -118}}

Pushing multiple data points to a single stream:

You can push arrays of data as the point to some types of widgets.

Sparkline/Line Graph

{"accessKey": "bGVmdHJvbmljaXNhd2Vz",
"streamName": "myNumber",
"point": [{"number": 15, "timestamp": 1329205474},
          {"number": 33, "timestamp": 1329206006},
          {"number": 42, "timestamp": 1329206519}]}

Note that the timestamps of the data points pushed to sparklines and line graphs should monotonically increase. Otherwise, your graph will likely have points that are connected to one another out of order.

Text Feed

{"accessKey": "bGVmdHJvbmljaXNhd2Vz",
"streamName": "myTextFeed",
"point": [{"title": "title1", "msg": "msg1"},
          {"title": "title2", "msg": "msg2"}]}


{"accessKey": "bGVmdHJvbmljaXNhd2Vz",
"streamName": "myMap",
"point": [{"latitude": 37.8, "longitude": -122.6},
          {"latitude": 88.3, "longitude": -100},
          {"latitude": 34, "longitude": -118}]}

XY Graph

{"accessKey": "bGVmdHJvbmljaXNhd2Vz",
"streamName": "myScatterPlot",
"point": [{"x": 15, "y": 20},
          {"x": 11, "y": 15},
          {"x": 33, "y": 44}]}

Pushing to multiple streams:

You can also push to multiple streams by using a streams key, where streams is a list of JSON objects, each having a streamName and point.

For example, a JSON object pushing to the mynumber and mymap streams would look like:

{"accessKey": "bGVmdHJvbmljaXNhd2Vz",
 "streams": [{"streamName": "mynumber",
              "point": 35},
             {"streamName": "mymap",
              "point": [{"latitude": 22.3,
                         "longitude": 114.2
                        {"latitude": 48.9,
                         "longitude": 2.35,
                         "color": "green"

Clearing a widget:

The Sparkline/Line Graph, Map, Text Feed, and XY Graph widgets can be cleared with a ‘clear’ command.

{"accessKey": "bGVmdHJvbmljaXNhd2Vz",
 "streamName": "yourStreamName",
 "command": "clear"}

Note that this wipes out all the data in this widget!

The others can be cleared by pushing an empty point.

{"point": {"list":[]}}