Hello
I’ve a problem with rules and sending an HTTP Request. If I send the following HTTP Request:
var url = "http://localhost:8888"
var String content = '{"from" : "OpenHAB", "to" : "Email_ADDRESS", "text" : "Test Message"}'
var response = sendHttpPostRequest(url, "application/json", content, 3000)
I receive this at the server:
POST / HTTP/1.1
Accept-Encoding: gzip
Content-Type: application/json
Host: localhost:8888
Content-Length: 69
{"from" : "OpenHAB", "to" : "Email_ADDRESS", "text" : "Test Message"}
As I need to add additional HTTP Headers I need the sendHttpPostRequest with addtional headers as shown in the online documentation (https://www.openhab.org/docs/configuration/actions.html):
sendHttpPostRequest(String url, String contentType, String content, Map<String, String> headers, int timeout)
I added the header in the code and adapted the sendHttpPostRequest
var headers = newHashMap("client_id" -> "1234567890abcdef", "API-Version" -> "2")
var response = sendHttpPostRequest(url, "application/json", content, headers, 3000)
In this case I received the error of too many arguments for the function. Error Message:
2020-08-31 15:07:00.118 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Send Alert': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.HTTP.sendHttpPostRequest(java.lang.String,java.lang.String,java.lang.String,int) on instance: null
Why do I receive this error?