# Http request with homey pro 2023

**URL:** <https://community.homey.app/t/http-request-with-homey-pro-2023/85941>\
**Category:** Questions & Help\
**Tags:** homey-pro\
**Created:** [August 3, 2023, 4:38am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941 "2023-08-03T04:38:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![nyjets](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nyjets/32/32090_2.png) [@nyjets](https://community.homey.app/u/nyjets)\
**Post date:** [August 3, 2023, 4:38am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/1 "2023-08-03T04:38:55Z")

</div>

Good morning,  
I got my new homey (2023) this week and currently, I´m checking, which apps are running and which apps are not running, before I start the migration.  
I query the oillevel from an API with the HTTP request-app. I have learned, there are some other possibilities with logic & advanced flows.  
I tried the “new” way, but it does not work.  
I assume, the format of the answer is the problem - there are backslashes in the answer but I have no idea to fix the problem.

The answer of the post:  
“{"DeviceResponse":[{"DeviceID":"5163306","DeviceName":"Gerhard Berger","Medium":"Heizöl","LastUpdate":"8/2/2023 8:00:02 AM","MaxVolume":"980","ActualVolume":"850","ActualVolumePercent":"87","Battery":"2.9","Temperature":"71","MessData":"39"}]}”

Do you have an idea, how I can handle this issue?

The interessting thing - in the post, the backslashes are not displayed:  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/3/e/3e5dbc298bd4fd03fb247737e655e5abcb485a65.png)

Thanks & cheers  
Gerhard

---

<div class="post-metadata">

**Author:** ![Adrian\_Rockall](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/adrian_rockall/32/13209_2.png) [@Adrian\_Rockall](https://community.homey.app/u/Adrian_Rockall)\
**Post date:** [August 3, 2023, 5:04am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/2 "2023-08-03T05:04:51Z")

</div>

The \ indicates the next " is a part of the data and not a delimiter (escape sequence). They might just be the way the data is formatted so it shows in the time line.

What exactly is the problem it is causing you?

---

<div class="post-metadata">

**Author:** ![nyjets](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nyjets/32/32090_2.png) [@nyjets](https://community.homey.app/u/nyjets)\
**Post date:** [August 3, 2023, 5:48am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/3 "2023-08-03T05:48:54Z")

</div>

I get the error: **obj needs to be an object**

My test flow is this:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/d/b/db1233233e2f2ec9eb19d5a6d4459cce39256aac.png)

I have another HTTP-Request running, and it works with the advanced flow.

---

<div class="post-metadata">

**Author:** ![To\_Lou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/to_lou/32/79159_2.png) [@To\_Lou](https://community.homey.app/u/To_Lou)\
**Post date:** [August 3, 2023, 5:57am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/4 "2023-08-03T05:57:08Z")

</div>

I encountered similar problem the other day, and I had to add another square bracket “[” and “]” arount the data to be fully identified as an object.

---

<div class="post-metadata">

**Author:** ![nyjets](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nyjets/32/32090_2.png) [@nyjets](https://community.homey.app/u/nyjets)\
**Post date:** [August 3, 2023, 6:10am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/5 "2023-08-03T06:10:01Z")

</div>

How have you inserted the square brackets?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [August 3, 2023, 6:16am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/6 "2023-08-03T06:16:15Z")

</div>

The API server returns the data double-encoded:

```auto
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Encoding: gzip
Content-Length: 312
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Aug 2023 06:15:19 GMT
Expires: -1
Pragma: no-cache
Server: Microsoft-IIS/10.0
Vary: Accept-Encoding
X-Powered-By: ASP.NET

"{\"DeviceResponse\":[{\"DeviceID\":\"5163306\",\"DeviceName\":\"Gerhard Berger\",\"Medium\":\"Heizöl\",\"LastUpdate\":\"8/2/2023 8:00:02 AM\",\"MaxVolume\":\"980\",\"ActualVolume\":\"850\",\"ActualVolumePercent\":\"87\",\"Battery\":\"2.9\",\"Temperature\":\"71\",\"MessData\":\"39\"}]}"

```

---

<div class="post-metadata">

**Author:** ![To\_Lou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/to_lou/32/79159_2.png) [@To\_Lou](https://community.homey.app/u/To_Lou)\
**Post date:** [August 3, 2023, 6:21am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/7 "2023-08-03T06:21:34Z")

</div>

> [@nyjets](#):
>
> How have you inserted the square brackets?

E.g script like:

> const string = “[”+data+“]”;

---

<div class="post-metadata">

**Author:** ![nyjets](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nyjets/32/32090_2.png) [@nyjets](https://community.homey.app/u/nyjets)\
**Post date:** [August 3, 2023, 6:51am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/8 "2023-08-03T06:51:28Z")

</div>

Ok, thanks!  
`till now, I have no script in place - so a new experience.  
That means, I do the http-call, afterwards I call a script, which insert the square brackets, write the result in the text variable and then I parse it or I assume, it´s also possible to do all in a script.  
Maybe you have an script example for me - would be great!

---

<div class="post-metadata">

**Author:** ![To\_Lou](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/to_lou/32/79159_2.png) [@To\_Lou](https://community.homey.app/u/To_Lou)\
**Post date:** [August 3, 2023, 7:43am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/9 "2023-08-03T07:43:17Z")

</div>

I think maybe you would try to just add the square brackets to the answer tag, before parse it to JSON?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [August 3, 2023, 7:46am UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/10 "2023-08-03T07:46:39Z")

</div>

The issue here isn’t missing square brackets, it’s an incorrect server response.

---

<div class="post-metadata">

**Author:** ![nyjets](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/nyjets/32/32090_2.png) [@nyjets](https://community.homey.app/u/nyjets)\
**Post date:** [August 3, 2023, 1:54pm UTC](https://community.homey.app/t/http-request-with-homey-pro-2023/85941/11 "2023-08-03T13:54:36Z")

</div>

I did a test, from the parse-card with square brackets in different formats, and it doesn´t work.

When I replace the backslashes and the first and last double quote, it works.

{“DeviceResponse”:[{“DeviceID”:“5163306”,“DeviceName”:“Gerhard Berger”,“Medium”:“Heizöl”,“LastUpdate”:“8/2/2023 8:00:02 AM”,“MaxVolume”:“980”,“ActualVolume”:“850”,“ActualVolumePercent”:“87”,“Battery”:“2.9”,“Temperature”:“71”,“MessData”:“39”}]}

I think, this can be handled with a script and not with a logic-card or is there a possibility?
