GET request with Headers and output to variable

Trying to build a flow that makes the GET request to outside server ( the request should have a header with api key (x-api-key:xxxyyyzzz) and I would like to get the response value saved to better logic variable.

Can someone point out how this can be made. I used the Homey logic to the request and got it to work with the headers and all, but cannot save it to better logic variable. example below


Got it to work with the HTTP request flow cards - app. In order to get the headers also to the request, you have to use full JSON description in the URL value to input the headers. Below is the example.

Thank you for sharing this solution. This is something I would like to use in a slightly different way. Hopefully you can help me in the right direction.
I use my Synology for Surveillance as a camera hub. Homey detects my family presence and sends a string to turn my presence ON/OFF. For authentication with my Synology I use a SID. You can retrieve this SID with a string. But this SID can change. So I would like to use Homey to automate the SID request URL and use this output as a variable.

  • The request URL is: https://[internal IP]:5001/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=3&account=[username]&passwd=[password]&session=SurveillanceStation&format=sid

  • The output response is:

  • My question:
    How can I select the output [SID] and use it as a variable? What flow do I need?

Thank you very much for all the help !!


You should use the HTTP request flow card “GET JSONpath Better Logic”-actioncard as I stated before.

In order to get the [SID] value into variable, you should use the JSONpath value of $.data.sid -> and save it to some better logic number variable.

There is some detailed descriuptions of the JSONpath values in here

Hopefully this helps, if not please feel free to ask.

1 Like

Hi Peltsi, First thank you very much for your help. Second … it works.

I had do make some changes …
The value of the $.data.sid is numbers+letters so I changed it to a string type variable.
Also it was bit confusing (probably it just my head) that I can just just that string variable as a “tag” inside an URL of a HTTP request flow card. But … it works :slight_smile:

Now I only need to find out how to have Homey accept a “insecure” https certificate :innocent:

I don’t think you can :frowning:


Can anyone tell me how I formulate multiple headers in the url? How do I divide them? Do I use double " around the soapaction, if the soapaction has them at the beginning and end standard?



Thank you, Robert for your quick response!!

@Enjoying my new Homey!

Can you also show me how to formulate this when I am using a Logic web request card?

I believe Logic webcards require you to enter each header line separately, which (AFAIK) is not possible through the mobile Homey app.

It’s possible through the desktop website by hitting Shift-Enter after each header line:

(I tried in Chrome on macOS, perhaps on Windows or other browsers “Shift” needs to be something else)

Ok, thank you, will try that tonight!!

I made this in the http request app and used Post Json, but it gives an error: cannot read property of ‘IndexOf’ of null. I put the headers in the url:



{<?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s=“” s:encodingStyle=“”> <s:Body> <u:X_SendIRCC xmlns:u=“urn:schemas-sony-com:service:IRCC:1”> AAAAAQAAAAEAAAAVAw== </u:X_SendIRCC> </s:Body> </s:Envelope>

What am I ding wrong?

Thanx for the help!

You need to use the “POST XML” card, not the “POST JSON” card.

UPDATE: managed to get homey script to work :slight_smile:


i have an similar challenge, i am looking at the Get json better logic card, but i have not been able to get it to work, and the dialog is not the same as in the screenshots in this thread?
i don’t see the text, text, search field.

i have also played around a bit with homey script, but have not been able to get it to work
i tested using the output from postman in nodejs.native but it did not work, but i suspect that homey script is different?

the request is simple:

Content-type: application/json
Authorization: Bearer TOKEN

the request returns

“hasValue”: true,
“time”: “2021-11-06T07:37:32 Europe/Oslo”,
“value”: -7.3033294677734375

i wish to take the value and use it in the next action in the flow to update the temperature of a virtual sensor