Using sendHttpPostRequest in a JS2021 script

Hi all,

I try to trigger a notification with pushcut. But my syntax seems to be wrong. Can you point me in the right direction?

In a JS 2021 Script I put the following:

var url = 'https://api.pushcut.io/v1/notifications/Restart';
var headers = ('accept:application/json','API-Key:___myKey____','Content-Type:application/json');
sendHttpPostRequest(url, headers,5000);

In the logs I get this:

2023-01-17 02:28:43.836 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID '3751d982bf' failed: ReferenceError: "sendHttpPutRequest" is not defined in <eval> at line number 3

I actually also tried this

HTTP.sendHttpPostRequest(url, headers,5000);

I found the answer here:

actions.HTTP.sendHttpPostRequest
1 Like