Hello,
I am making calls to the HTTP REST API but it looks like the response returned by PRTG has the incorrect response content headers.
For example I make a call like:
GET /api/table.xml?username=prtgadmin&passhash=xxxxxx&content=sensors&columns=device%2C+type%2C+sensor%2C+status%2C+lastvalue%2C+group%2C+lastdown%2C+lastcheck%2C+lastup,message&output=xml
HTTP/1.1
Host: 10.xx.xxx.xxx
Accept: application/xml
user-agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) advanced-rest-client/12.1.4 Chrome/61.0.3163.100 Electron/2.0.2 Safari/537.36
As you can see I have the output query parameter and the Accept request header both set to XML.
The response I receive does contain XML in the body but the content-type header in the response message is says HTML. Thus my code tries to handle the response as HTML and not XML.
For example, the response headers I receive look like:
connection:
close
content-type:
text/html; charset=UTF-8
content-length:
134918
date:
Fri, 12 Oct 2018 21:37:25 GMT
expires:
0
cache-control:
cache, must-revalidate
x-content-type-options:
nosniff
x-xss-protection:
1; mode=block
content-disposition:
attachment; filename=table.xml
pragma:
public
server:
PRTG/18.3.44.2059
I would think that since XML is being returned in the message body then the message header should have a content-type of application/xml as is standard with REST APIs. Having XML return with an HTML content-type seems to violate the HTTP paradigm.
Thanks
Add comment