Invalid URI host: null

Hello,
i try to use a rule with sendHttpGetRequest with a json-url and actually i get some illegal characters errors.
I tried to find a solution and found urlencoder but i still get follow error.

==> openhab.log <==
2018-03-12 22:06:39.994 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Steckdose’: Invalid URI host: null (authority: 192.168.22.12%2F%3Fcmd%3D200%26json%3D%7Bport%3A1%2Cstate%3A1%7D)

thats the rule file:

import java.net.URLEncoder

rule "Steckdose"
    when
        Item gPower received command
    then
        switch(receivedCommand) {
		
            	case ON :{
			var poweron = URLEncoder::encode('/?cmd=200&json={port:1,state:1}','UTF-8');		
			sendHttpGetRequest("http://192.168.22.12" + poweron);
			}
		        	
		case OFF:
			{
			var poweroff = URLEncoder::encode('/?cmd=200&json={port:1,state:0}','UTF-8');
			sendHttpGetRequest("http://192.168.22.12" + poweroff);
			
			}
		}
end

anybody know a solution?

Regards, Web

This shouldn’t be encoded this way. At the least, you need to not url encode the path separator and query operator:

192.168.22.12/?cmd=200&json=%7Bport%3A1%2Cstate%3A1%7D

Thanks for help,

does exist a converter for this? I need many adresses and dont like to convert each address manually.

Regards,
Web

i see i need only to convert the json content. not it works. thanks for help.

Regards, Web