{"id":15409570,"url":"https://github.com/bradymholt/smartthings-rest-api","last_synced_at":"2025-07-04T12:33:57.409Z","repository":{"id":66149779,"uuid":"83167164","full_name":"bradymholt/smartthings-rest-api","owner":"bradymholt","description":"SmartThings REST API","archived":false,"fork":false,"pushed_at":"2020-05-28T17:42:45.000Z","size":10,"stargazers_count":54,"open_issues_count":1,"forks_count":21,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-19T10:58:59.778Z","etag":null,"topics":["home-automation","rest-api","smartthings"],"latest_commit_sha":null,"homepage":null,"language":"Groovy","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bradymholt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-25T22:27:26.000Z","updated_at":"2025-02-25T09:05:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e5eaee9-13b8-4e3f-a3eb-c8a563d72735","html_url":"https://github.com/bradymholt/smartthings-rest-api","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.09090909090909094,"last_synced_commit":"131f97ede0ce4531a3627c7f5e1a5db66d8f0570"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bradymholt/smartthings-rest-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradymholt%2Fsmartthings-rest-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradymholt%2Fsmartthings-rest-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradymholt%2Fsmartthings-rest-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradymholt%2Fsmartthings-rest-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bradymholt","download_url":"https://codeload.github.com/bradymholt/smartthings-rest-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bradymholt%2Fsmartthings-rest-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263542603,"owners_count":23477455,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["home-automation","rest-api","smartthings"],"created_at":"2024-10-01T16:40:38.094Z","updated_at":"2025-07-04T12:33:57.387Z","avatar_url":"https://github.com/bradymholt.png","language":"Groovy","readme":"# [SmartThings](https://www.smartthings.com/) REST API\n\n## Setup\n\n### Installation\n\n1. Login at https://graph.api.smartthings.com/\n2. Navigate: My SmartApps \u003e New SmartApp \u003e From Code (tab)\n3. Paste contents of rest-api.groovy\n4. Click: Create, Publish \u003e For Me\n6. Navigate: App Settings \u003e OAuth\n7. Click: Enable OAuth in Smart App\n8. Note the Client ID (i.e. `abc123`) and Client Secret (i.e. `def321`)\n\n### Get Access Token via OAuth \n\n1. Replace the client_id value and open this URL in a browser: https://graph.api.smartthings.com/oauth/confirm_access?response_type=code\u0026scope=app\u0026redirect_uri=http%3A%2F%2Flocalhost\u0026client_id=abc123\n2. Login and Click \"Authorize\".\n3. You will be redirected to http://localhost; note the code query value (i.e. aD4kF5 in http://localhost/?code=aD4kF5)\n4. Run `curl -v -H \"Content-Type: application/x-www-form-urlencoded\" -X POST --data 'grant_type=authorization_code\u0026code=aD4kF5\u0026client_id=abc123\u0026client_secret=def321\u0026redirect_uri=http%3A%2F%2Flocalhost' https://graph.api.smartthings.com/oauth/token`\n5. Note access_token in response (i.e. `xyz123`).  **This will be the access token used to authenticate to the REST API.**\n6. Run `curl -v -H \"Authorization: Bearer xyz123\" https://graph.api.smartthings.com/api/smartapps/endpoints`\n7. Note the `uri` value (i.e. https://graph1.smartthings.com/api/smartapps/installations/123987). **This will be the Endpoint URL used to access the REST API.**\n\n## Usage\n\n_(Assumming Access Token: `xyz123` and Endpoint URL: `https://graph1.smartthings.com/api/smartapps/installations/123987`)_\n\n\n#### List Devices\n```\ncurl -v -H \"Authorization: Bearer xyz123\" \\\n  https://graph1.smartthings.com/api/smartapps/installations/123987/devices\n```\n\n#### Get Device Attribute (i.e. on/off for a switch)\n```\ncurl -v -H \"Authorization: Bearer xyz123\" \\\n  https://graph1.smartthings.com/api/smartapps/installations/123987/device/123/attribute/switch\n```\n\n#### Turn Device On\n```\ncurl -H \"Authorization: Bearer xyz123\" -X POST \\\n  https://graph1.smartthings.com/api/smartapps/installations/123987/device/123/command/on\n```\n\n#### Turn Device Off\n```\ncurl -H \"Authorization: Bearer xyz123\" -X POST \\\n  https://graph1.smartthings.com/api/smartapps/installations/123987/device/123/command/off\n```\n\n#### Adjust Brightness to 50%\n```\ncurl -H \"Authorization: Bearer xyz123\" -X POST \\\n  https://graph1.smartthings.com/api/smartapps/installations/123987/device/123/command/setLevel?arg=50\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradymholt%2Fsmartthings-rest-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbradymholt%2Fsmartthings-rest-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbradymholt%2Fsmartthings-rest-api/lists"}