SmartThings REST API
abc123
) and Client Secret (i.e. def321
)curl -v -H "Content-Type: application/x-www-form-urlencoded" -X POST --data 'grant_type=authorization_code&code=aD4kF5&client_id=abc123&client_secret=def321&redirect_uri=http%3A%2F%2Flocalhost' https://graph.api.smartthings.com/oauth/token
xyz123
). This will be the access token used to authenticate to the REST API.
curl -v -H "Authorization: Bearer xyz123" https://graph.api.smartthings.com/api/smartapps/endpoints
uri
value (i.e. https://graph1.smartthings.com/api/smartapps/installations/123987). This will be the Endpoint URL used to access the REST API.
(Assumming Access Token: xyz123
and Endpoint URL: https://graph1.smartthings.com/api/smartapps/installations/123987
)
curl -v -H "Authorization: Bearer xyz123" \
https://graph1.smartthings.com/api/smartapps/installations/123987/devices
curl -v -H "Authorization: Bearer xyz123" \
https://graph1.smartthings.com/api/smartapps/installations/123987/device/123/attribute/switch
curl -H "Authorization: Bearer xyz123" -X POST \
https://graph1.smartthings.com/api/smartapps/installations/123987/device/123/command/on
curl -H "Authorization: Bearer xyz123" -X POST \
https://graph1.smartthings.com/api/smartapps/installations/123987/device/123/command/off
curl -H "Authorization: Bearer xyz123" -X POST \
https://graph1.smartthings.com/api/smartapps/installations/123987/device/123/command/setLevel?arg=50