Netatmo Weather のAPIをとりあえず使ってみる

準備

  • https://dev.netatmo.com/
  • 上部メニューCREATE YOUR APP クリック
  • App name, App Description を入力
  • "I accept Netatmo APIs Terms and Conditions" にチェックを入れて同意する
  • Client idClient secret が作成される

API使ってみる

curl -w '\n' 'https://api.netatmo.com/oauth2/token' --data 'grant_type=password&client_id=xxx&client_secret=xxx&username=xxx&password=xxxx&scope=read_station' -X POST
{"access_token":"xxxx","refresh_token":"xxx","scope":["read_station"],"expires_in":10800,"expire_in":10800}
  • access_token を使用してAPIにアクセス
curl https://api.netatmo.net/api/getstationsdata\?access_token\=xxx
json のレスポンス

json のレスポンスが返ってきて、中のデータ(温度や湿度など)が正しいことを確認出来た。