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


Article Comments

Hi Astropcr,

I have to agree with you, this looks like a bug. I will open a development ticket for further analysis/fixing the issue.

Thank you very much for letting us know!

Kind regards


Andreas Günther
Tech Support, Paessler AG


Oct, 2018 - Permalink

This should be fixed in PRTG v18.4.46.1754 :)


PRTG Scheduler | PRTGapi | Feature Requests | WMI Issues | SNMP Issues

Kind regards,
Stephan Linke, Tech Support Team


Nov, 2018 - Permalink