Securely Embedding Dashboards (API)

If you want to programatically generate secure share URLS to dynamically change the filters, you can use Silota's embed API.

How sharing URL generation works

The shared URL has the form:

https://console.silota.com/s/<dashboard_id>/?{filters}&darkMode={true|false}&showHeader={true|false}&signature={signature}

with four parts to it:

  • filter parameters
  • darkMode
  • showHeader
  • signature

The filter parameter is a URL encoded JSON blob with the following structure:

{
  dateAggregation: "monthly|quarterly|etc.";
  dateRange: {
    "start": "2017-10-01T19:00:00.000Z",
    "end": "2017-10-31T19:00:00.000Z"
  },
  filters: [
    {
      "filterId": "df_2099e26936fb483ebbaa477183135b53",
      "value": "Michigan",
      "label": "Michigan"
    },
    ...
  ]      
}

The signature is a SHA256-HMAC of the API key and the complete URL path, including the JSON blob.

Javascript Example

We make use of hash.js to generate our signatures.

var hash = require('hash.js');
var sha256 = hash.hmac(hash.sha254, api_key);
var filters = {
  ...
};

var url = "/s/" + dashboard_id + "/?"
    + encodeURIComponent(JSON.stringify(filters))
    + "&darkMode=false&showHeader=true"

var signature = sha256.update(url).digest('hex')

var final_url = "https://console.silota.com/"
    + url        
    + "&signature=" + signature;

Python Example

import json, hmac, hashlib, urllib
api_key = "MY_API_KEY"
dashboard_id = "MY_DASHBOARD_ID"
filters = {
  ...
}
encoded = urlib.urlencode(json.dumps(url)) + "&darkMode=false&showHeader=true"
url = '/s/' dashboard_id + "/?" + encoded

signature = hmac.new(api_key, msg=url, digestmod=hashlib.sha256).hexdigest()

final_url = 'https://console.silota.com' + url + '&signature=' + signature

Next Generation SQL Data Analysis Write SQL, visualize data, and share your results. Onboarding forward-thinking teams now:

No spam, ever! Unsubscribe any time. Learn more about the product.

results matching ""

    No results matching ""