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}' https://pushapi.appinsights.com/
 
# 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}}' https://pushapi.appinsights.com/
 
# 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}}' https://pushapi.appinsights.com/

USA Map, World Map Widgets:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"latitude": -81.98, "longitude": 11.70}}' https://pushapi.appinsights.com/
# 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"}}' https://pushapi.appinsights.com/

Text Feed Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"title": "myTitle", "msg": "myMsg"}}' https://pushapi.appinsights.com/
 
# Or add an image URL to the text feed:
 
curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"title": "myTitle", "msg": "myMsg", "imgUrl": "http://goo.gl/uqHsk"}}' https://pushapi.appinsights.com/

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}]}}' https://pushapi.appinsights.com/
 
# 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": "%"}]}}' https://pushapi.appinsights.com/
 
# 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"}]}}' https://pushapi.appinsights.com/

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}}' https://pushapi.appinsights.com/

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"}]}}' https://pushapi.appinsights.com/

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"}}' https://pushapi.appinsights.com/

Image Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"imgUrl": "http://goo.gl/uqHsk"}}' https://pushapi.appinsights.com/

Label Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"label": "In search of 1988"}}' https://pushapi.appinsights.com/

Table Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"table": [ ["header1", "header2"], ["R1C1", "R1C2"], ["R2C1", "R2C2"], ["R3C1", "R3C2"] ]}}' https://pushapi.appinsights.com/ 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"]}}' https://pushapi.appinsights.com/

Gallery Widget:

The “msg” parameter is optional.

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"title": "myTitle", "msg": "myMsg", "imgUrl":"http://goo.gl/uqHsk"}}' https://pushapi.appinsights.com/

HTML Widget:

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

XY Graph Widget:

curl -X POST -d '{"accessKey": "bGVmdHJvbmljaXNhd2Vz", "streamName": "yourStreamName", "point": {"x": 16, "y": 32}}' https://pushapi.appinsights.com/

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}]}' https://pushapi.appinsights.com/

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]]}}' https://pushapi.appinsights.com/

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"}' https://pushapi.appinsights.com/

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" } ] } ]}' https://pushapi.appinsights.com/

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 https://pushapi.appinsights.com/ -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 https://pushapi.appinsights.com/ -d "{\"accessKey\": \"YOUR_ACCESS_KEY\", \"streamName\": \"yourStreamName\", \"point\": 42}"