Hi Folks, how do I fetch a PRTG chart as .png using the HTTP REST API using curl on Linux?

According to the API documentation, the command line schould look like this:

curl -O -k --location -H "Accept: image/png" -X GET https://prtg/chart.png?type=graph&width=600&height=300&graphid=0&id=54807&username=myUSer&passhash=1234567

Authentication and stuff works fine. MY chrome browser (and even the postman-plugin) show the wanted result. However, the curl-call basically returns an HTML page stating that

JavaScript is not available

Which is correct, as curl obviously does not handle this. Is there a way to pick up just the png image/byte stream?

Best Regards HH


Article Comments

Hi HH,

Keep in mind that the URL contains zwi Special characters. ? = Placeholder in regEx & = concat string to chain commands. You have to Excape them or but put some " aroung

My Line works, too

curl -o c:\temp\test.png -k -v -X GET "https://prtg:443/chart.png?type=graph&width=600&heigh t=300&graphid=0&id=1002&username=prtgadmin&password=xxxxxx"

BTW: You cannot use BasicAuth, because PRTG is not using an authentication Header. the URL contains the Authentication Information. So it is more like "Form Based" wiht prefilled forms.

Frank


Sep, 2016 - Permalink