5 comments
-
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.
-
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!
-
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.
-
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!
-
I know this is a few years old but just tried your refresh button html and it didn't work. Anything changed on the KF side that would make this no longer work?