Webapi

I have just migrated to Homey 2.0. I have waited a long time so that ‘all’ problems and bugs where solved.

But unfortunately I ran into a problem. I can’t access the webapi anymore from my mobile phone. I use that to automatically switch on/off my alarm when leaving or coming home.
I know that there is a new bearer token but still can’t acces the webapi.

Does anyone know what has been changed?

Correct me if i’m wrong but V2.X doesn’t have webacces anymore. You can edit flow through you’re browser with https://flow.homey.app/.

@Peter_Post, I 'am not talking about access to flows ‘the old way’ but access to the webapi

there is no old way. https://flow.homey.app/ is the new way

The web API is just working but you need to be authenticated.
It is still possible by stealing the bearer token but that one is longer and changing periodically.
Other way is using the provided authentication
https://developer.athom.com/api/projects

That’s the developer page. Not the flow editor.
But it’s possible that I don’t understand what tb1962 is trying to do.

I assume you mean that your mobile phone was making HTTP requests to Homey? If so, what were the URL’s that you use?

@robertklep: The url that i used with vs Homey 1.5x is (just an example):
https://.homey.athom.com/api/app/net.i-dev.betterlogic//1

@Dijker: That api is only for local access. Not for remote access via my phone

You have the Better Logic app for V2 installed, right?

In that case all you need to do is lookup the new style bearer token and use it in the URL to post data to Homey, just like you used it in V1.

Those URL’s won’t work anymore without authentication. I assume (can’t remember) that they used to work on v1.5 without authentication?

You might want to take a look at this tutorial that uses the HTTP Request Flow Cards app to trigger flows on incoming HTTP requests (even though the tutorial is for iOS, it gives you the info you need to act on incoming HTTP requests, no matter where those requests are coming from).

@anne, Yes i have tried that. but it didn’t work. I have used the long 3 part bearer token in the header. Also tried a slightly differend url that i found somewhere:
https://.homey.athom.com/api/manager/apps/app/net.i-dev.betterlogic// but also with no luck

The URL should start with https://CLOUDID.connect.athom.com

It works for me, although I only use it locally. The URL you posted is not complete, you need to specify an endpoint which you can match in a flow?

Something like this (only snippet I have handy at the moment, a curl system call from Python)…

os.system(’/usr/bin/curl -H “HOST: (Homey IP)” -H “Authorization: Bearer (bearertoken)” -H “Content-Type:application/x-www-form-urlencoded” -X POST (Homey IP)/api/app/com.internet/eastron --data “power={0:.3f}”’.format(Active_Power))

In a flow triggercard you can match the ‘eastron’ endpoint and extract the value for the ‘power’ varable.

Sorry. Something went wrong when copying text. The url should be: https://CLOUDID.homey.athom.com/api/manager/apps/app/net.i-dev.betterlogic/VARNAME/VALUE

@robertklep. Thanx Robert. That works liker a charm.

Note that in v2.1.1 the bearer token will change daily, effectively breaking this setup :expressionless: