I'm accessing the Maker API from my local webserver (part of EventGhost) and it works well from anywhere on my local lan. However, when I access it from outside the network, my webpage loads fine but the API fails. The console log shows "TypeError: Failed to fetch" at the function that does a fetch.
function getdata(dev,val) { //read Hubitat via API
const url = "http://192.168.1.137/apps/api/16/devices/?access_token=xxxxxxxxxxxxx";
fetch(url)
.then((response) => {
return response.json();
})
.then((data) => {
//process data here...;
})
.catch(function(error) {
console.log(error);
});
}
What could be causing this? Do I need to setup some special port forwarding in the router? Someone suggested that it may be a "CORS issue", but from what I've researched on that, it would be probably be way beyond my paygrade.