Hi,
I'm trying to connect to PRTG to request some information via the API tools.
I'm requesting URL: https://myserver/api/table.json?content=sensors&columns=objid,group,device,sensor,status,message,lastvalue&username=myapiuser&passhash=myhash
When I run this URL, I'm getting an error message "Unauthorized".
I can't get out of this error. Can you please help me on this issue. Regards
Article Comments
Hi, I'm sorry but I don't understand what is wrong in my query. I've tested the link https://yourserver/api/table.xml?content=sensors&columns=sensor&username=myuser&passhash=hash and I'm still getting error 401 Unauthorized
Regards Cyril
May, 2020 - Permalink
Hello Cyril,
What PRTG version are you using?
Please let me know whether the following API call works for you:
http(s):your-prtg/api/table.xml?content=sensors&columns=sensor&username=prtgadmin&password=prtgadmin |
Please adjust "http(s):/ /your-prtg" and "password=prtgadmin" to your actual configuration.
Best,
Sebastian
May, 2020 - Permalink
I'm running version 20.1.56.1547+
the url is working. XML file downloaded.
Cyril
May, 2020 - Permalink
Ok, good then let's start from here. Start by updating your PRTG to the latest version. Then slowly adjust the API query. If you want to use the Passhash instead find the one that has to be used in PRTG under "Setup | Account Settings | My Account | Show Passhash" and change your API call "password=prtgadmin" to "passhash=hash".
May, 2020 - Permalink
So now, I'm up to date with PRTG, but it's still not working. Unauhorized. I've testes with params password and passhash -> ko If I test with a user issued for local AD it's working. Finally I've decided to create a new "test api" user and it's working... ?!?!? no difference between the two account
So now it's ok. test user is renamed to a more usefull name ! Thanks for support.
Jun, 2020 - Permalink
Hi there,
The issue is that your authentication section of the API query is syntactically not valid.
Authentication with username and passhash (or username and password) must always be included in each PRTG API request. See section Authentication for more information.
Best regards,
Sebastian
May, 2020 - Permalink