SwitchBot API v1.1のリクエスト用curlを生成する

下記の入力欄に値を入力すると、動的にcurlのコードが生成されます。

GitHub SwitchBotAPI

認証用トークン
クライアントシークレット
requestID
デバイスID
コマンド
パラメータ

デバイス一覧を取得する

curl --request GET 'https://api.switch-bot.com/v1.1/devices' \
  --header 'Authorization: 認証用トークン' \
  --header 't: UNIXタイム' \
  --header 'sign: 署名' \
  --header 'nonce: ランダム値' \
  --header 'Content-Type: application/json; charset=utf8'

デバイスの状態を取得する

デバイスID
curl --request GET 'https://api.switch-bot.com/v1.1/devices/デバイスID/status' \
  --header 'Authorization: 認証用トークン' \
  --header 't: UNIXタイム' \
  --header 'sign: 署名' \
  --header 'nonce: ランダム値' \
  --header 'Content-Type: application/json; charset=utf8'

コマンドを実行する

デバイスID
コマンド
パラメータ
curl --request POST 'https://api.switch-bot.com/v1.1/devices/デバイスID/commands' \
  --header 'Authorization: 認証用トークン' \
  --header 't: UNIXタイム' \
  --header 'sign: 署名' \
  --header 'nonce: ランダム値' \
  --header 'Content-Type: application/json; charset=utf8' \
  --data-raw '{
    "commandType": "command",
    "command": "コマンド",
    "parameter": "パラメータ"
  }'

関連記事

スポンサーリンク

先頭にフロートがあるリストアイテム要素でリストマーカーが要素内に入り込む

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る