概要
SwitchbotでAPIを取得する際に、各Switchbot製品のdeviceIdを取得する必要があり、APIv1.0で取得する実行結果。
APIv1.0で取得すると、コマンドがシンプルなのと一度で取得できるので、おすすめ。
コマンドにあるトークンはSwitchbotのスマフォアプリケーションから代入してください。
$ curl -H "Authorization:トークン" -X GET "https://api.switch-bot.com/v1.0/devices" | jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1289 100 1289 0 0 13568 0 --:--:-- --:--:-- --:--:-- 13568
{
"statusCode": 100,
"body": {
"deviceList": [
{
"deviceId": "",
"deviceName": "",
"deviceType": "Plug Mini (JP)",
"enableCloudService": true,
"hubDeviceId": ""
},
{
"deviceId": "",
"deviceName": "",
"deviceType": "MeterPro(CO2)",
"enableCloudService": false,
"hubDeviceId": ""
},
{
"deviceId": "",
"deviceName": "",
"deviceType": "Plug",
"enableCloudService": true,
"hubDeviceId": ""
},
{
"deviceId": "",
"deviceName": "",
"deviceType": "Meter",
"enableCloudService": true,
"hubDeviceId": ""
},
{
"deviceId": "",
"deviceName": "",
"deviceType": "Hub Mini",
"enableCloudService": false,
"hubDeviceId": ""
},
]
},
"message": "success"
0 件のコメント:
コメントを投稿