# API call with gzip encoding

**URL:** <https://discourse.nodered.org/t/api-call-with-gzip-encoding/77971>\
**Category:** General\
**Created:** [27 April 2023 01:37 UTC](https://discourse.nodered.org/t/api-call-with-gzip-encoding/77971 "2023-04-27T01:37:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![leftymuller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/leftymuller/32/102326_2.png) [@leftymuller](https://discourse.nodered.org/u/leftymuller)\
**Post date:** [27 April 2023 01:37 UTC](https://discourse.nodered.org/t/api-call-with-gzip-encoding/77971/1 "2023-04-27T01:37:00Z")

</div>

Hello!

Ive asked ChatGPT to help me but it didnt give a viable solution

Ive done API calls before without any issues but this API service has gzip encoding  
I have put an "Accept-encoding" into the http request.

However all im getting back as expected is garbage.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/477cd08b99cdf340067bfb2a2eb11cac85268382.png)

Has anybody done this before? any help appreciated as usual 🙂

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [27 April 2023 01:49 UTC](https://discourse.nodered.org/t/api-call-with-gzip-encoding/77971/2 "2023-04-27T01:49:10Z")

</div>

I guess you will need to unzip it to see the content ?

Take a look at node-red-contrib-gzip

---

<div class="post-metadata">

**Author:** ![leftymuller](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/leftymuller/32/102326_2.png) [@leftymuller](https://discourse.nodered.org/u/leftymuller)\
**Post date:** [27 April 2023 02:06 UTC](https://discourse.nodered.org/t/api-call-with-gzip-encoding/77971/3 "2023-04-27T02:06:09Z")

</div>

Thanks for the reply!

the gzip node only compresses not uncompresses ?

ChatGPT talked about gunzip but that node doesnt exist (that I can see anyway)

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [27 April 2023 02:08 UTC](https://discourse.nodered.org/t/api-call-with-gzip-encoding/77971/4 "2023-04-27T02:08:11Z")

</div>

compress or decompress

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [27 April 2023 06:37 UTC](https://discourse.nodered.org/t/api-call-with-gzip-encoding/77971/5 "2023-04-27T06:37:59Z")

</div>

> [@leftymuller](#):
>
> the gzip node only compresses not uncompresses ?

Not quite true,

Passing a string, will compress said string, passing a buffer, will decompress said buffer.

So instead of returning a string from your request (assuming HTTP Request Node), get it to return a buffer, and pass that, the node will then treat it as a compressed buffer, and decompress it.

---

<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:** [26 June 2023 06:38 UTC](https://discourse.nodered.org/t/api-call-with-gzip-encoding/77971/6 "2023-06-26T06:38:13Z")

</div>

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