cancel
Showing results for 
Search instead for 
Did you mean: 

receive PDF from API

MichalBezak1
Level 3
HI All,

I need to receive the PDF from API as File.

Below is a screenshot from API docs
15813.png

What I'm receiving is Respond content below: How can I transform it to PDF file?, or is there any option how to receive already a file and wave it in PC

%PDF-1.3
%����
9 0 obj
<<
/Type /ExtGState
/ca 1
>>
endobj
10 0 obj
<<
/Type /ExtGState
/ca 1
/CA 1
>>
endobj
12 0 obj
<<
/Type /ExtGState
/CA 1
>>
endobj
8 0 obj
<<
/Type /Page
/Parent 1 0 R
/MediaBox [0 0 595.28 841.89]
/Contents 6 0 R
/Resources 7 0 R
>>
endobj
7 0 obj
<<
/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
/ExtGState <<
/Gs1 9 0 R
/Gs2 10 0 R
/Gs3 12 0 R
>>
/XObject <<
/I1 5 0 R
>>
/Font <<
/F1 11 0 R
/F2 13 0 R
>>
>>
endobj
6 0 obj
<<
/Length 3844
/Filter /FlateDecode
>>
stream
x��]_��
�O1_��D�5p��$m�<hsoA��n�����/)S���hg���6pn�K�e�(��ds���� �+9��t:y0��=��v}zЧ����&�O�y����d�W�N&�h�����?��o��������V�T���>|��Ws��ׇ�=t�W��OR�,��t�1rWpq�CLj
i�x/��r�I�A�]��e�Q�AC]��6F�Q�\���v1�i#py��Sn#pq�m�ô�b�Kmm��3����*kƨu��¤)G�����(�W������V՝ ��;���䌉�E�S�׭����"x7i3�i2�Z���H�H�ޣ
��̳�;y��
����Cг� �?����w4�������m��;B8]�EB<�M͞����7���y�]`���f:}@��`N8@�~}��6�Q�����:



------------------------------
Michal Bezak
HW analysist
IBM ISC
Europe/Bratislava
------------------------------
4 REPLIES 4

Hi,

You can use action 'HTTP Request File' from 'Utility - HTTP' object https://github.com/blue-prism/http-communication-utility

------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Singapore
+6581326707
------------------------------

AndreyKudinov
Level 10
You have your pdf, now just save it with Utility - File Management - Write Binary Data action.

------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------

Hi Andrey,

Any suggestions?

I found a code stage which should convert text to binary but it's not working as my response content is not just plain text

15807.png


------------------------------
Michal Bezak
HW analysist
IBM ISC
Europe/Bratislava
------------------------------

What are you using to call your API and get pdf?
Utility - HTTP or Web API services?

Here is slightly modified action for Utility - HTTP that returns binary:
https://gist.githubusercontent.com/aikudinov/1f06b8e794064f08d84e4628e8ce8885/raw/f5d180e6cff4f73a0021e194e94fecb97707c177/gistfile1.txt

I'm not sure if Web API can receive binary properly. Last time we needed that Web API was not released yet and we used that action above + I read later here somewhere that it wont work with Web API, but things might have changed. I would need find something to test on to check that.

p.s. Similar discussion
p.p.s. You don't have to actually get stream to binary data item and then write it - just something I had at hand already working.
You can just save it directly to a file in VBO code stage, but sometimes binary can be useful too - like you can extract files from zip stream without saving anything to a disc etc.

------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------