3

Provide "Refresh Data Source" option for a klip from the Dashboard screen

From My Dashboard, it would be SUPER useful to be able to click on the settings icon (gear) for a Klip and have a "Refresh data source" option, along with edit, share, etc.

4 comments

  • 1
    Avatar
    Andrew Pandelakis
    Yes, and it would be nice to display on the Klip when the data source was last updated. I'm always wondering how old is the data being displayed.
  • 0
    Avatar
    Caroline Blake
    I would love it if this also displayed when it was most recently refreshed somehow, after the manual refreshing of the data source you're suggesting. I am frustrated when I manually refresh a data source in the admin, but then the klips aren't actually refreshed yet b/c they are cached and the klip-view is waiting in the queue to be updated... So basically I totally agree with Andrew!
  • 0
    Avatar
    Serge Esteves
    Yes, it would be great to manually refresh a data source directly on a klip and display when the data source was last updated. The goal for example is to save up some credits to an API and refresh data only when it's necessary. Max refresh rate is 24h and sometimes for some data you don't need to refresh so often.
  • 0
    Avatar
    Bret Truchan

    I know that these requests were from a few years ago, but I wanted to explain a work-around.  First, create a Klip that contains an HTML template.  For the HTML template, add the following HTML:

    <button id="refresh-datasources">Refresh Datasources</button><br><br>

    And for the Javascript, enter the following.  Of course, use your own data source ids to refresh plus your own API key.

    $("#refresh-datasources").on("click", function() {

    var datasource_ids = [
      "165...",   // enter your own datasource ids here
      "b73...",
      "9bc...",
      "d7c...",
      "a55..."
    ];

    $.each(datasource_ids, function(index,value) {

      $.ajax({
        url: 'https://app.klipfolio.com/api/1/datasource-instances/' + value + '/@/refresh',
        type: 'post',
        headers: {
            "kf-api-key": "{your api key}"
        },
        dataType: 'json'
      });

    });

    alert("Completed.");
    });

    Hope this helps!

     

Please sign in to leave a comment.