Homey Community Forum

Simple HTTP Connector For Flows

Hi @volodeev, welcome on the forum!
Do you know how long the sid is valid?
With my app its not possible to do two calls stepping through a login/authentication within one flow. At least it’s not done yet.
But… what if we do the login call, put the response sid in a Better Logic variable and reuse that (via a token) in the second request. Is that worth trying?

Hi. Yes, I know that it’s not easy. I am not a JavaScript programmer. Therefore, I can not use HomeyScript. Help me please.

I am thinking of breaking this task down into 3 stages:

  1. post request with authorization to receive SID
  2. GET request https://lk.saures.ru/api/company/flats?sid=ea533f69-7880-4938-9fdf-522d2a929ee5
  3. GET request https://lk.saures.ru/api/meter/meters?sid=ea533f69-7880-4938-9fdf-522d2a929ee5&flat_id=4731

Hi @Erik!
The SID through Postman does not change unless cookies are deleted. With a new authorization, the SID changes, but the old SID also continues to operate.

I like your idea of ​​putting the SID in a Better Logic variable and reusing it. But … I can’t extract the SID, because I don’t know how to send an authorization request correctly. Help me please.

I am thinking of breaking this task down into 3 stages:

  1. post request with authorization to receive SID
    001
  2. GET request https://lk.saures.ru/api/company/flats?sid=ea533f69-7880-4938-9fdf-522d2a929ee5
    002
  3. GET request https://lk.saures.ru/api/meter/meters?sid=ea533f69-7880-4938-9fdf-522d2a929ee5&flat_id=4731

Hi, I’m new to this app.
It looks promissing in the description - but I seem to lack some examples.
I have just tried to do some simple http commands, and the Homey just responds with “Ok”, but no actions are performed, neither on devices nor on flows. A small toturial or examples would be nice.
Thanks
Casper

Hi @CasperD! There are a lot examples posted on the forums. Have you checked the full app store description? (also available here: https://github.com/irritanterik/homey-http-request-actions/blob/master/README.md).
What do you want to achieve with the flow you created?

Is it possible to get through a http request your actual coördinates. For example https://www.gps-coordinaten.nl/waar-ben-ik or google maps. Would be very interesting. For me it would be a way to update rain information when i am bycicling on a different place as where Homey stays. And yes I don’t always carry Homey with me😛
I have no clue how to do this

Hi @Erik
The README, got me to where I am now, but the examples are not complete, the documentation discusses an event, but what is that in Homey environment, Homey has: Devices, Flows, Triggers.

Assuming that I have a device ‘Lamp’,
I make a http request :
http:///api/app/com.internet/Lamp
http:///api/app/com.internet/Lamp/on
Or any deviation, all responds with “Ok”, no action performed on the ‘Lamp’
Assuming that I made a flow ‘X’ (Trigger is ‘This flow started’)
http:///api/app/com.internet/X
Responds “Ok” but flow is not executed

And u also made the flow to receive the GET request like this?

I’m trying to use the Evaluate JSON condition card (C22) but I need to specify headers with the request. I dont seem to be able to get it right. I have tried the following in the query parameters field:

  • {“Authorization”:“Bearer somerandomstring”}
  • {‘Authorization’:‘Bearer somerandomstring’}
  • {Authorization:‘Bearer somerandomstring’}
  • {headers:{‘Authorization’:‘Bearer somerandomstring’}}
  • {headers:{Authorization:‘Bearer somerandomstring’}}

All to no avail, the app even crashes with some of these attempts. @Erik, could you explain me what I’m doing wrong and should I submit a bug due to the app crashing?

[EDIT]
I got it to work using the node http options in the URL field but only when putting some bogus json in the query parameter field. Leaving this empty causes the app to crash.