Fetch Data

Start by setting up custom widgets on your dashboard by choosing “Custom Data” from the data service panel, selecting “Fetch Data”, and then choosing from the family of widgets.

Configure the widget by clicking on the small gear at the upper right, then clicking on Edit Widget Settings. You can then enter a URL to pull data from, and select a polling interval. When you are done, click Save and you should see this data in your dashboard right away, and then at the preset time intervals.

Supported authentication methods

  • Basic Access Authentication, also known as Basic Authentication
  • Custom Header Authentication
  • API Key in URL

Unsupported authentication methods

  • OAuth and OAuth 2.0
  • Signature

If your data URL is Basic Auth protected, you must first select “Select an Authentication” under the dropdown titled Authentication. You can then enter the Username/Password in the appropriate boxes. Otherwise, if the URL is protected by another header authentication method, you can enter up to two header-value pairs by selecting Custom Headers under the Authentication Type dropdown.

The data in the URL must be JSON formatted, using the Leftronic Data Format. For example:

For a number widget:

{"number": 35, "prefix": "$"}

For a text feed widget:

[{"msg": "message 1", "title": "title 1"},
 {"msg": "message 2", "title": "title 2"}]

See the Leftronic Data Format reference for more examples.

If your data is not JSON formatted, we can still display your data as long as you write some simple Javascript to turn it into the Leftronic Data Format. Let’s say that your data URL returns data that looks like this:

{
    "status": "OK",
    "data": {
        "trends": {
            "rank": [
                {
                    "date": "201510",
                    "value": 174618
                }
            ]
        },
        "trends_low_sample": true,
        "query_cost": 1,
        "trends_frequency": "monthly"
    }
}

This data is available to you in your custom Javascript code, as the variable “data”. It is a string, so that we can handle any type of data and not just JSON.

If you wish to access the data at the “value” key, that is the number 174618, and display this on a number widget, you can write Javascript that looks like the following:

var obj = JSON.parse(data);
return {"number": obj.data.trends.rank[0].value};

This turns the data into the Leftronic Data Format for the “Number” type.

You can even parse non-JSON data. For example, if your URL returns a string that looks like:

<html><body>Build number: 357</body></html>

Your script can look like:

var searchStr = "Build number: ";
var idxFrom = data.indexOf(searchStr) + searchStr.length;
var idxTo = data.indexOf("</body>", idxFrom);
return {"number": parseFloat(data.substring(idxFrom, idxTo))};

This script would return {“number”: 357}, which is in the Leftronic Data Format.

If you restrict access to your systems, you can whitelist these IPs for the Fetch Data Tool.