Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 400: Invalid JSON #787

Open
NikCode101 opened this issue Jan 19, 2023 · 1 comment
Open

Error 400: Invalid JSON #787

NikCode101 opened this issue Jan 19, 2023 · 1 comment

Comments

@NikCode101
Copy link

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
Copy link

kbrown01 commented May 15, 2023

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)\"}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants