Platform Features
...
Features for Insights
Rest API Integration To Fetch ...
Fetch Insights with API
7 min
fetching insights with api based integration click on the api button (indicated by a settings wheel) below the visualization how to use the api settings? each qualetics insight will provide the following parameters to be used for integration app id app secret client id insight url the parameters are displayed in the api settings dialog window example code in order to render the insight in a web app, two rest api calls need to be performed get authentication token perform a post request to render the insight the following is an example rest api call using javascript to perform the authentication and post request respectively and load into an html div container first define html div container add the following script reference to d3 js to support visualizations \<script type="text/javascript" src="https //d3js org/d3 v5 min js">\</script> generate token var token; $(document) ready(function(){ let appid = "add374eb 1c45 4297 a668 0ff459dafei80"; let appsecret = "dab2b4df e660 4549 8d76 a7bf54e86722"; $ post("https //iamapi qualetics com/generatebasictoken",{"clientid"\ appid,"secretid"\ appsecret}, function(data, status){ 	token = data basic token; 	getchart(); }); }); post request to fetch insight //get chart function getchart(){ $ ajax({ url "https //portaladmin qualetics com 3004/chartrouter/api/v1/ac101/6204fecccc41847b2d61bc79", type 'post', headers {"authorization" token}, data {'token'\ token,'fromdate' '2022 10 03','todate' '2022 10 30','utcoffset' ' 4 00','clientid' "dev diaramble com"}, error function(err) { $("#res") html(err); }, success function(data) { console log('satya',data); $("#res") html(data); } }); } the full example including the html is shown below (note the example below uses jquery as well) the resulting view would load the insight as below