Hi, I'm trying to query the PRTG API for historic data to put on an internal dashboard style website. However, whenever I try to access the historic data via xml, my Chrome tells me:
Origin http://mywebsite is not allowed by Access-Control-Allow-Origin.
As it would, because the Access-Control-Allow-Origin header is not being received from the PRTG api.
How can I configure the PRTG api to return a Access-Control-Allow-Origin which includes my website address?
Thanks,
Sam
Article Comments
Is there any way to workaround this? E.g. wrap the XML in json so I can execute a JSONP request and then parse the XML within?
Thanks,
Sam
Mar, 2013 - Permalink
You can do this: $.ajax({ type: "GET", url: url, dataType:'jsonp', cache: false, crossDomain: 'true', success: function(result){ do something } });
but then you get problems with the server header returning the wrong mime-type (text/html), witch i haven't been able to bypass. Should the mime-type returned be application/json ?
Jul, 2013 - Permalink
Please see this article for how to set the value for the Access-Control-Allow-Origin HTTP response header with a registry key option. You can use this feature as of PRTG version 15.x.20.
Sep, 2015 - Permalink
Hello,
I'm very sorry, but currently it's not possible to set this header for API Calls.
best regards.
Mar, 2013 - Permalink