JSON POST with App "Simple HTTP Connector For Flows"

Hi,

I am trying to to use a HTTP Request app to make a JSON POST.

I am able to get it working in a software called Fiddler Webdebugger and there it looks like this:

I create a HTTP Request flow card POST JSON
and put this in the first textbox at top: http://192.168.1.141:8123/api/services/light/turn_on

and in the second box i put:

{
“authorization”: “Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9……….”,
“content-type”: “application/json”,
“host”: “192.168.1.141:8123”,
“Content-Length”: “62”,
“entity_id”: “light.hall_uppe_tak”,
“brightness”: “0”
}

But when i test it in Homey i get an error: “Unexpected token: in JSON at position 3”

Does anyone know what i am doing wrong?

Best Regards Jonas

If that is literally the JSON that you’re trying to post, the issue is with the fancy quote characters that it contains ( and ). Those should be plain quote characters (").

But that won’t fix your problem, because you’re also mixing headers and data, which is not how the HTTP app works.

You need to put this in the first box:

{
  "method": "post",
  "protocol": "http",
  "hostname": "192.168.1.141",
  "port": 8123,
  "path": "/api/services/light/turn_on",
  "headers": {
    "authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
    "content-type": "application/json",
    "host": "192.168.1.141:8123"
  }
}

Possibly as a single line:

{"method":"post","protocol":"http","hostname":"192.168.1.141","port":8123,"path":"/api/services/light/turn_on","headers":{"authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...","content-type":"application/json","host":"192.168.1.141:8123"}}

And this in the second:

{
  "entity_id": "light.hall_uppe_tak",
  "brightness": 0
}

Single line:

{"entity_id":"light.hall_uppe_tak","brightness":0}

And lastly: there are a few integrations that will help integrate Home Assistant with Homey so you don’t have to use HTTP requests to control HA-managed devices:

hoi hoi

Ik heb sinds dit weekend de wifi modulle en ben er mee aan het stoeien.
Nu probeer ik de ventilator via Json aan het aansturen bv http://192.168.1.195/api.html?command=auto
Nu lukt het me niet in een logica te krijgen voor m’n Homey 2019.
Kan iemand mij op weg helpen?