cancel
Showing results for 
Search instead for 
Did you mean: 

Covert Json Response to Required Data Formats

vinodchinthakin
Level 9
Hi All,

I would like to convert Json response to required data formats.

1. I am using an API, which compresses image and output response will be in Json(Text) format. How can I convert Response content into Image(Binary) data type?
2. I am using an API which converts HTML to PDF and output response will be in Json(Text) format. How can I convert response content into PDF(Binary) data type?

Note: we have utility JSON which helps in converting Json to Collection. But we need to convert Json to other formats, do we have any Assets or Codes for that?

Any suggestions!
Thanks in advance.
VINOD

------------------------------
vinod chinthakindi
------------------------------
15 REPLIES 15

Hi Vinod,

If you can share examples for both then it will be helpful to look into possible solutions.

For 1 - Does the JSON has a base64 encoded text?
For 2 - Does the JSON has any server path to the PDF file?

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

Thanks for quick reply shashank.

Pls find below screenshots.

1.find response content. We dont see any base64 encoded text18287.jpg

2.  there is no any server path to the PDF file
18288.png

Query: If the output of the API response is Image/PDF, how can we download/store in local system from API?



------------------------------
vinod chinthakindi
------------------------------

Hi Vinod,

1 - This seems to be in binary format. What does the API documentation say? Utility - HTTP has an action called HTTP Request File which you can use for this.

2 - What does the API documentation say about the response body and response content? If it's binary already(which seems likely to me) then you can use the same action HTTP Request File

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

Hi shashank,

API documentation doesn't says anything on API response.
I don't see any HTTP Request File in HTTP Request VBO.
Can you name the action and inputs params to be provided?


------------------------------
vinod chinthakindi
------------------------------

Hi Vinod,

You can download the latest version of HTTP Utility from DX https://digitalexchange.blueprism.com/dx/entry/3439/solution/utility---http

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

Hi Shashank,

I tried with HTTP Request file by passing URL and method, but getting an error "empty path is not legal"

------------------------------
vinod chinthakindi
------------------------------

Hi Vinod,

Did you pass the FilePath in the input parameter?

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

Yes I included Url of File within API for testing
http://api.pdflayer.com/api/convert?access_key=access_key&document_url=https://pdflayer.com/downloads/invoice.html&secret_key=secret_key

------------------------------
vinod chinthakindi
------------------------------

Hi Vinod,

FilePath is another parameter in the action. This is the pdf file path where the binary data response from the API will be written into. For example - C:\myfile.pdf

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