sidoh / esp8266_milight_hub

Replacement for a Milight/LimitlessLED hub hosted on an ESP8266
MIT License
931 stars 219 forks source link

Error 400: Invalid JSON #787

Open NikCode101 opened 1 year ago

NikCode101 commented 1 year ago

Hello everyone!

I'm trying to send a POST request with JSON, a Bearer token, and a payload. I get "Error 400: Invalid JSON" message. I can the payload received as well as the received and decoded of the bearer/token successfully.

curl -X POST https//website.com/files/folders -H "Content-Type: application/json" -d '{"name":"Nik","email":"abc@abc.com"}' -H "Accept: application/json" -H "Authorization: Bearer {token_info}"

Any idea what I'm missing or how to bypass this error message?

Thank you in advance;.

What is the model number of the device you're trying to control?

What firmware version(s) have you tried?

Which ESP8266 board are you using? (nodemcu, d1_mini, etc.)

Which radio type are you using? (RGBW, RGB+CCT, etc.)

Have you tried controlling the device with a physical remote?

### Output of http://milight-hub.local/about and http://milight-hub.local/settings

/about

"... /about output. put between the ```s"

/settings

"... /settings output. put between the ```s"
kbrown01 commented 1 year ago

Are you running curl on Linux or Windows? If you are running on Windows then you:

1) Must use all " and no single ' 2) To accomplish this, you need to escape all " inside the JSON payload like this: -d "{\"name\":\"Nik\",\"email\":\"[abc@abc.com](mailto:abc@abc.com)\"}"