This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Rest API
nklerk
Member
in Developers
i would like to use the rest API, I must be silly but I can't find the developer button on my homey under system to request an API key anyone have an idea?
Comments
PS: The developer option show up once you run an app from the cli.
in the mean time i had created an app and couldn't find the API key
I am able to get a rest (json) response, unfortunately its allays error 404 formated in json.
i am trying a simple get http://10.0.0.108/api
with or without the Authorization: Bearer ........... i always get a 404 status with content 404 formated in json.
when i get the described /managers/devices/categories/
http://10.0.0.108/api/managers/devices/categories/ result = status 404 with Json content 404
http://10.0.0.108/managers/devices/categories/result = status 404
I have allso tried:
https://<homey-ID>.homey.athom.com/api/
same result: status 404 with Json content 404
i must be missing the obvious... especially while i couldn't find any similar posts.
well i found what i was looking for:
curl --request POST --data "{\"text\": \"Hello world\"}" -H "Authorization: Bearer -----------------------------------------------" -H "Content-Type: application/json" http://10.0.0.108/api/manager/speech-output/
you can get the bearer ID by logging in to my.homey.com select your username, on the homey selection screen rightclick on your homey and copy the hex code string and use it as the Bearer.
Hopefully someone can easily use this.
My deurbel is going to send this post to my homey from this evening on, and ill kill the crappy relaid powered ringer. well not "hello world" but you get the idea.
the API guide states managers opposed to manager. that's what went wrong.
looks like the get of /api to receive all API options inst working yet.
https://forum.athom.com/discussion/1165/local-logon-not-possible-when-there-is-no-internet-connection
Maybe a WebHook is a better solution.
The docs unfortunantly specify 'managers' endpoints for the API, where it must be 'manager' (without s).
I tried logging out and logging on (in an incognito browser) and changed my PW....
And still I get the same Bearer Token....
I there a way to Reset the Bearer Token(s) in case of misuse of it?
The REST API docs are extremely outdated. Most calls can be observed in Chrome's inspector while using the Homey interface. Don't expect them to stay the same though.
After upgrading to 0.8.35 I did a reset and full wipe. I now have a new bearer token so there is a way to reset it, although I have no idea at which point it was changed (I did not alter anyting in my Athom account so that's not it)
I believe that it is created on the initial login (so during the setup when you login).
curl http://10.0.0.108/api/app/nl.klikaanklikuit/ -H "Authorization: --------------------------------" -H "Content-Type: application/json"
Try looking at the Dashboard @swttt is creating that is using the REST API
https://forum.athom.com/discussion/1736/room-dashboards/p1
But now that you are talking about it.
@emile or @Annemarie
when is the REST API page coming back? updated and all
2.0 can feel like 1.0
https://athomcommunity.slack.com/archives/general/p1472217743008420
Expect nothing
Let me share my findings and hope someone may be able to use it. Ill post some curl examples as many know how this works and are able to translate this in something useful.
First you will need to know your bearer token. this can be obtained by using the browser and login to https://my.athom.com when you are able to sellect your homey view the url. in the url you will find the bearer token.
In my examples ill use 0123456789abcdef0123456789abcdef as my bearer token
and i use 10.0.0.208 as my homey IP address.
Get all devices:
curl -H "Authorization: Bearer 0123456789abcdef0123456789abcdef " -H "Content-Type: application/json" http://10.0.0.208/api/manager/devices/
Get all devices within a zone:
curl -H "Authorization: Bearer 0123456789abcdef0123456789abcdef " -H "Content-Type: application/json" http://10.0.0.208/api/manager/devices/?zone=01234567-89ab-cdef-0123-456789abcdef
?zone=01234567-89ab-cdef-0123-456789abcdef you can find the zone id with the get zones:
curl -H "Authorization: Bearer 0123456789abcdef0123456789abcdef " -H "Content-Type: application/json" http://10.0.0.208/api/manager/device/01234567-89ab-cdef-0123-456789abcdef
Fill in the device ID. at the end like i used 01234567-89ab-cdef-0123-456789abcdef as a reference.