Hi , I have writen a RESTFull web service accept JSON format. This service works on local server in company. Any client in company can post data(HTTP POST) to url. All successful. BUT.I configure a notification for EXECUTE HTTP ACTION. I enter the url and post data. Then test notification , There is no affect.


Article Comments

Dear nogay_42

The HTTP Action does allow custom HTTP headers, so it canot send the content type "application/json". As a workaround, please perform this HTTP action via a powershell script which you can run as an Exe notification. This small snippet demonstrates how the HTTP action is done:

$postjson="{ "test_id": 1, "name": "A test" }"
Invoke-WebRequest -Uri http:/127.0.0.1:5051/api -Method POST -ContentType application/json -Body $postjson

Jun, 2017 - Permalink

Thanks Arne Seifert , I try to post via powershell is working but parameter $postjson="{"details":"testdata"}" give error like "Unexpexted token 'details':"testdata" } in expression or statement"


Jun, 2017 - Permalink

Dear nogay_42

Our support for customization is limited, we are unable to going this through with you to debug this. It could be the case that you need to escape quotation marks, or use different quotation marks.


Jun, 2017 - Permalink

Thanks Arne Seifert, Maybe I have asked my question wrong. Ok. What Http methot does PRTG use for HTTP ACTION. (GET,POST,DELETE). This can solve may problem. How to send parameter to url. I can design my Restful service for this.


Jun, 2017 - Permalink

Dear nogay_42

If you enter any postdata, HTTP POST will be used. Otherwise, it is HTTP GET.


Jun, 2017 - Permalink

Thanks , I can send any data via PRTG by HTTP GET. But I have an new problem . Placaholders not working like below. %device is transmitted %device. No replace there

http://mydomain/prgt/signal.svc/signal?sender=ABABABA&test=Alert For device %device


Jun, 2017 - Permalink

In this case, please update PRTG as the placeholders used in the postdata field should be resolved.


Jun, 2017 - Permalink

I don't understand . Where can I update placaholders. Is it not nececassry to use in URL query string. like %device,%message etc..


Jun, 2017 - Permalink

Dear nogay_42

I am sorry, I am lost now. Do you use the postdata field at all?


Jun, 2017 - Permalink

No. I don't use postdata field. I use only Url field like http://mydomain/prgt/signal.svc/signal?test=%device , But %device not replaced by any device name. This field came to my server like '%device'. There is no replace on placeholder.


Jun, 2017 - Permalink

Dear nogay_42

Please let me know, if /prgt/ is correct (instead of /prtg/). Please also let me know if you test the HTTP action via the "Test" button of the notification, or via an (simulated) error?


Jun, 2017 - Permalink

Dear Arne Seifert, /prgt is correct. I have written mistake :) But web service works well. I use Test button of notification.


Jun, 2017 - Permalink

Dear nogay_42

With the test button, there is no triggering device, hence the unresolved placeholder. You can test it with putting the notification on a sensor, and then use the context drop down menu to simulate an error in order to trigger the notification.


Jun, 2017 - Permalink