Smashing / smashing

The exceptionally handsome dashboard framework in Ruby and Coffeescript.
https://smashing.github.io/
MIT License
3.22k stars 324 forks source link

How do I feed List widget using json? #169

Closed Gmerold closed 4 years ago

Gmerold commented 4 years ago

Hi,

I'd like to feed list widget using json sent via curl. The problem is that I can't figure out how my data should look like. Based on what 'Buzzwords' job from examples is sending I tried something like this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", items: [{:label=>"XXXXXX", :value=>"XXXXX"}] }' http://SERVER:3030/widgets/WIDGET_DATA_ID. Unfortunatelly, what I get is: 2020-06-26 15:34:31 - JSON::ParserError - 765: unexpected token at '{ "auth_token": "YOUR_AUTH_TOKEN", items: [{:label=>"XXXXXX", :value=>"XXXXXXX"}] }': Any help highly appreciated.

BR, Bartek

kinow commented 4 years ago

Hi @Gmerold !

For questions like this, it's easier to use our Gitter chat:

I realized we didn't have any docs on how to post data to widgets (none that I could find at least). So I wrote this one: https://github.com/Smashing/smashing/wiki/How-to:-post-data-to-your-dashboard-and-widgets

Feel free to send feedback via gitter, or edit the page as necessary. I still need to add a bit more about the events sent to dashboards, but that should hopefully help you to update the widget with JSON.

Cheers Bruno