Command Line

In February 2018, we decided to deprecate our Leftronic Data Format, and PushAPI to allow our platform to move forward to a newer, better way helping you with your data.

As of Jan 1, 2019, our PushAPI is being turned off. We recommended moving to our Fetch API to replace your current needs.

If you’d like to push data from a command line interface, you can use the cURL tool to send data to your widget.

Number, Horizontal/Vertical Bar, Dial Widgets:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": 42}'
# Or, you can add an optional prefix/suffix/timestamp key. In this case, the "number" key is required:
curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"prefix": "$", "number": 33}}'
# Or you can send a "delta" key instead of a "number" key. This will add to (or subtract from) the latest number in the stream.
curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"prefix": "$", "delta": 299}}'

USA Map, World Map Widgets:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"latitude": -81.98, "longitude": 11.70}}'
# Or choose a color for your map point
# (red, blue, green, purple, and yellow only)
curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"latitude": -81.98, "longitude": 11.70, "color": "blue"}}'

Text Feed Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"title": "myTitle", "msg": "myMsg"}}'
# Or add an image URL to the text feed:
curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"title": "myTitle", "msg": "myMsg", "imgUrl": ""}}'

Leaderboard, Pie Chart, Bar Chart Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"leaderboard": [{"name": "Cheryl", "value": 57}, {"name": "Megan", "value": 32}, {"name": "Marisa", "value": 23}, {"name": "Frankie", "value": 11}, {"name": "Keeley", "value": 7}, {"name": "Kristen", "value": 3}, {"name": "Kelly", "value": 3}]}}'
# Or add an optional prefix or suffix key per leaderboard element:
curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"leaderboard": [{"name": "Cheryl", "value": 57, "suffix": "%"}, {"name": "Megan", "value": 32, "suffix": "%"}, {"name": "Marisa", "value": 23, "suffix": "%"}]}}'
# Or add an optional color key per bar chart element:
curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"chart": [{"name": "Cheryl", "value": 57, "color": "yellow"}, {"name": "Megan", "value": 32, "color": "blue"}, {"name": "Marisa", "value": 23, "color": "red"}]}}'

You can also add a single item to an existing leaderboard, as follows:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"leaderboardItem": {"name": "Nigel", "value": 2150}}'

List Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"list": [{"listItem": "Cheryl"}, {"listItem": "Megan"}, {"listItem": "Marisa"}, {"listItem": "Frankie"}, {"listItem": "Keeley"}, {"listItem": "Kristen"}, {"listItem": "Kelly"}]}}'

You can also push a single list item at a time, which will push that item to the top of an already existing list:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"listItem": "Celebrate good times"}}'

Image Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"imgUrl": ""}}'

Label Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"label": "In search of 1988"}}'

Table Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"table": [ ["header1", "header2"], ["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"] ]}}' You can push a single row at a time to an already existing table. This will append the row to the top of the table:
curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"tableRow": ["Value 1", "Value 2"]}}'

Gallery Widget:

The “msg” parameter is optional.

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"title": "myTitle", "msg": "myMsg", "imgUrl":""}}'

HTML Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"html": "<H3>Hello world!</H3>"} }'

XY Graph Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"x": 16, "y": 32}}'

Array of XY Pairs (Use for X-Y Graph):

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": [{"x": 16, "y": 32}, {"x": 30, "y": 60}]}'

Map, text feed, and sparkline/line graph widgets can also take arrays of data in a similar way. If passing an array of numbers to a sparkline or line graph, each number will require a UTC timestamp as well, and these must be passed in ascending order.

Multi-bar Graph Widget (array of arrays):

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"matrix":[["Years","Barcelona","Real Madrid","Atlético"],["2010",95,102,62],["2011",114,121,53],["2012",115,103,65],["2013",100,104,77]]}}'

Note that the first element of the first array is not displayed and you can use an empty string if desired.

Programmatically clear widgets:

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

The others can be cleared by pushing an empty point.

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "command": "clear"}'

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

Pushing to multiple streams at once:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streams": [ { "streamName": "mynumber", "point": 35 }, { "streamName": "mymap", "point": [ { "latitude": 22.3, "longitude": 114.2 }, { "latitude": 48.9, "longitude": 2.35, "color": "green" } ] } ]}'

Working with proxy servers:

If you use a proxy server, you may need to use the following switches within your command:

-x <proxy server> --proxy-<basic, anyauth, etc.>

For example:

curl -X POST –x  --proxy-anyauth -d "{"accessKey": "YOUR_ACCESS_KEY", "streamName": "yourStreamName", "point": 42}"

Working in Microsoft Windows:

When using the cURL command in Microsoft Windows, you may need to escape the double quotes (“) by including a backslash (\) before each double quote: 

curl -x POST -d "{\"accessKey\": \"YOUR_ACCESS_KEY\", \"streamName\": \"yourStreamName\", \"point\": 42}"