API for flukso to api.flukso.net

Hi,

I searched github for a spec or examples for the api that is used for the flukso sending its data every 5 Minutes to https://api.flukso.net, but wasn't successfull. I tend to host all my data on my own host. What I have in mind is an owncloud flukso app making heavy use of d3.js.

gebhardm's picture

Isn't the code the best docu? ;-)
At least two corresponding code snippets I found...
See \openwrt\package\flukso\config\flukso.uci

  1. config settings daemon
  2. # ...
  3.         option wan_base_url https://api.flukso.net/
  4. #...

and \openwrt\package\flukso\luasrc\fluksod.lua
  1. -- set WAN parameters
  2. local WAN_ENABLED       = (FLUKSO.daemon.enable_wan_branch == '1')
  3.  
  4. local TIMESTAMP_MIN         = 1234567890
  5. local WAN_INTERVAL          = 300

But you are also free to use the local API, of course; see corresponding thread https://www.flukso.net/content/req-noob-guide-extract-data-csv-or-dbase

holgerG's picture

Thanks gebhardm,

I looked at the server side code, which didn't help me. To get more information, what client and server do actually talk to each other, I tried to get in between. My first attempt was to make the client connect my server. Both request and response are hmac'ed (just a replacement for client and server certificates). Now I'm trying to figure out, how this is done in lua (client side) and erlang (server side). My job will be, to do this with php (server-side), since I will leave the client untouched.
For now I didn't figure out what keys and values are used for the hmac. I will continue this in a few days.

holgerG's picture

I managed to write a little proxy in php. If you point your flukso to it, it will store your readings in your own DB but still forward all data to api.flukso.net. This data is then used for a d3.js based web application.
I put everything on GitHub: https://github.com/hgruber/flukso-proxy
for a demo of the d3.js based webclient have a look at: https://www.gruber-frankfurt.de/flukso/

The webclient is not tuned for speed yet, so it's best viewed with chrome. Zoom in by selecting an area on the time-axis to get an idea of what can be done with d3.js (d3js.org).