# Zodiac Chlorinator HTTP request flow broken

**URL:** <https://discourse.nodered.org/t/zodiac-chlorinator-http-request-flow-broken/77550>\
**Category:** General\
**Created:** [14 April 2023 05:05 UTC](https://discourse.nodered.org/t/zodiac-chlorinator-http-request-flow-broken/77550 "2023-04-14T05:05:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tico](https://avatars.discourse-cdn.com/v4/letter/t/a88e57/32.png) [@Tico](https://discourse.nodered.org/u/Tico)\
**Post date:** [14 April 2023 05:05 UTC](https://discourse.nodered.org/t/zodiac-chlorinator-http-request-flow-broken/77550/1 "2023-04-14T05:05:56Z")

</div>

I have an existing flow that stopped working about 4 days ago. It's using an unoffical method to retrieve data from a cloud based pool chlorinator app. My suspicion is that the manufacturer has changed something in the output format. I haven't changed anything in my installaton.

 ![Chlorinator Flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b1a1214e3b71ab225466b9d57434b9028cc04acc.jpeg)

Node-Red gives an error "JSON parse error" in the debug. The string that is displayed has a lot of garbage symbols.

![Parse error](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/16377a7a1a09848cddd649bddc89fda4af949644.jpeg)

I have retrieved the content of the HTTP POST request using an alternative manual method (non Node-Red). This displays all information successfully. So it seems to be just the JSON parsing that is hitting a new snag.

I've attached a picture of the output of the manual POST retrieval. Are there any characters that could cause the parsing error? And how might I fix this?

 ![Pool Credentials](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/3/533eaccfca3a74bb522b5e201c151bdfe863fd4e.jpeg)

The IdToken highlighted is used in a subsequent flow for data retrieval.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [14 April 2023 08:13 UTC](https://discourse.nodered.org/t/zodiac-chlorinator-http-request-flow-broken/77550/2 "2023-04-14T08:13:43Z")

</div>

Perhaps it is now coming as compressed data. I think you can specify a header to tell it to uncompress, but I am not certain how to do that.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [14 April 2023 08:17 UTC](https://discourse.nodered.org/t/zodiac-chlorinator-http-request-flow-broken/77550/3 "2023-04-14T08:17:52Z")

</div>

If that is the case the it's possibly the `Accept-Encoding` header that needs to be set ... I think it should be set to `identity` for no compression (but I have tested that),

---

<div class="post-metadata">

**Author:** ![Tico](https://avatars.discourse-cdn.com/v4/letter/t/a88e57/32.png) [@Tico](https://discourse.nodered.org/u/Tico)\
**Post date:** [14 April 2023 09:50 UTC](https://discourse.nodered.org/t/zodiac-chlorinator-http-request-flow-broken/77550/4 "2023-04-14T09:50:49Z")

</div>

Thanks! That was it. `accept-encoding` to `identity` fixed it.

For anyone else who ends up here, the complete working Function node preceeding the http request -

```auto
msg.method = 'POST';
msg.headers = {};
msg.headers['Host'] = 'prod.zodiac-io.com';
msg.headers['accept'] = 'application/json';
msg.headers['content-type'] = 'application/json';
msg.headers['accept-encoding'] = 'identity';
msg.headers['user-agent'] = 'okhttp/3.12.0';
msg.url = 'https://prod.zodiac-io.com/users/v1/login';
msg.payload = '{"api_key":"generic_key_here", "email":"you@your_email.com", "password":"Your_password"}';
return msg;

```

The previous version had `accept-encoding` as `gzip`. All the subsequent POST requests using the initial IDToken also need to have the `accept-encoding` changed to `identity`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 April 2023 09:51 UTC](https://discourse.nodered.org/t/zodiac-chlorinator-http-request-flow-broken/77550/5 "2023-04-28T09:51:43Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
