SwitchBotAPI
SwitchBotAPI copied to clipboard
Elaboration of error docs
Describe The Bug:
Not actually a bug, but the documentation seems unclear to me with regard to error responses.
To Reproduce:
Send a control command that is incompatible with a device specified in the URL. I tried sending a setAllStatus command (exclusive to Smart Fan) using a DIY TV ID.
curl -H "Authorization:[MY_API_KEY]" https://api.switch-bot.com/v1.0/devices/[DIY_TV_ID]/commands \
-H "Content-Type: application/json" \
-X POST -d '{"commandType":"command","command":"setAllStatus","parameter":"on,1,1,60"}'
Then, this curl returns {"statusCode":160,"body":{},"message":"No this command"}.
Expected behavior:
The returned response is not listed here. There is a 160, but other information such as about other possible keys and possible values they may take is a bit obscure IMHO.
Screenshots: N/A.
Device Model: N/A, I suppose.
SwitchBotAPI
- Use Case: I'm developing a Node.js client for the API and I want to grasp every possible response the API could return (be it success or failure) as accurately as possible, so that I can define strict types.