Skip to content

Providing Data to Widgets

Dimitrios Zorbas edited this page Nov 8, 2016 · 2 revisions

The usual way to feed your widgets with data is to broadcast from jobs.

See: https://github.com/kittoframework/kitto#jobs on how to define jobs.

Updating using HTTP POST

Alternatively for you can use HTTP POST to wigdets/:id where :id is what you have set as data-source in your widget.

Example:

<!-- File: dashboards/some_dashboard.html.eex -->
<li data-row="1" data-col="1" data-sizex="2" data-sizey="1">
  <div class="widget-welcome"
       data-widget="Text"
       data-source="greetings">
  </div>
</li>

Run in your terminal (make sure you have curl installed on your system)

curl -XPOST http://localhost:4000/widgets/greetings -d '{ "text": "Greetings from Athens!" }'