How to convert HTTP request response into file stream

HI team,

I am getting file content in string format after calling API. i have to convert into file stream for saving attachment to local folder.

Can anyone please help me out ?

Thanks in advance.

Regards,
Deepak

We would use the following option to save the returned file:

For more control we would model a custom calling by using the HTTPClient:

Hi!

Normally when you call an API that is set to download an Attachment, it will be automatically downloaded in the project’s folder.

However, if you want to write the response content of an API to a .txt, you can use the Write Text File activity.

i am getting file content in below format that we have to convert into file stream first. we will then convert file stream into base 64 for saving attachment.

Also, we are using body format as “application/json”. can you please explain how we can solve this problem ?

��$��$�!V�iB���e��p ��R�5��}���}��e�n��� ����������)HLO�M,J��+V�IM+�U2�3WR(�Lπ�K� ���J

I�%%��0^FjbJj�g�����_������eg����������PK�����!���Na��� �����xl/theme/theme1.xml�Y͋e7��? sw�5�%���l��$d�����QV32��e%9�R(���Bo=��@

�� $���’��#��$�lJZv

�G������~z�t�ҽ�zG� ’�_�P�=��ؘ$Ӗk8(4|OH��e n� ,�K۟~rm����Dl��I9�*�����f8��&��H�#���ޘ+�R�#��^�bP{}2!#�

�J{��O�1�B

�(�W��%���òB���R�!��a�1;�{��(~h�%���/�V&D�YCn��2�L`|X�s���j� �Z{�_�\����Z��ҧh4�����:�n�a

P�ա�W�U���_]�����נT�� ��E �A)>\Ç�f�g�נ_[��K�^P��kPDIr��.��jw��d��� �A��)�Q�

��RSLX"7�Z��2>��R$I��� O����(9���%�o�&`�T)

JU��>���#��02��]`�XeR�xb��L��+��7 /�={����=����_���*Kna%SS�Տ_���

not sure if it was done as we mentioned:

If so then ensure that the file is read in with read text file activity within the right character encoding.

We do not recommend to use the output from:
grafik

As it risks character encoding confusions. Therefore we mentioned as an alternate also:

I used in my code but it is not giving me output

image

As long we do not know all details, we can only give general fix hints. Also we dont know, what is done in detail e.g. for the checks.
As we mentioned:

Or test it by manually opening with a recommended text editor like: notepad++
Kindly note:: only for file types of text we can expect a valid result and not for binary data

What Fiel type is expected? Was all this done?

When URL is public, then also share with us, if further assistance is needed.

We would also remind on:

why we have to read content in from text file when we have response content.

DO we need to first save locally ?

Because of the following we have a risk:

Maybe it will help when you reread all mentions and suggestions and will have a look on:

Just take your time for this as it will avoid ping-pongs and will lead you faster to the solution.

UPD1 -

also keep in mind: