I am using AmCharts Wordpress plugin to generate graphs on a Wordpress page. To have the graph load its shape and (external) data, AmCharts uses Javascript to load on the client side when generating the graph. However, this javascript also contains the URL to the API used to retrieve the external data.
This means that anyone can easily view the web site source code and see this link. This is a risk as anybody can now manipulate the URL and download our full database with data.
I have added the first part of the JavaScript code below. the URL part I like to obscure is https://api.xxxxxxx.com/
Any way this is possible? What options are available?
Thanks for any help!
try {
// Themes begin
var chart = am4core.create("amchart1", am4charts.XYChart);
var from = Math.round(+new Date() / 1000) – 2629743;
var to = Math.round(+new Date() / 1000) + 2629743;
chart.dataSource.url = 'https://api.xxxxxxx.com/' + from + '/' + to;
chart.dataSource.events.on(“parseended”, function(ev) {
// parsed data is assigned to data source's data property
var data = ev.target.data;
for (var i = 0; i < data.length; i++) {
if(data[i]["realtime_value"] == 0)
delete data[i]["realtime_value"];
}
console.log(‘data’, data);
});
// create date axis
...