Solved

download file using service broker from an API

  • 28 July 2020
  • 2 replies
  • 16 views

Dear all,

 

I am using servive broker to read from third party API to get document info. The ussue is:

 

1- how can I pass the byte array since service broker doesnt support byte as property type.

2- how can I download the file via button on a view.

 

with regards.

icon

Best answer by boringNerd1 30 July 2020, 07:58

View original

2 replies

Badge +15

Hi,


 


If you have ever store any file via SmartObject into a database, you should notice that K2 stores the file in the following format:


 


<file>


  <name>FILENAME</name>


  <content>BASE64_ENCODED_STRING</content>


</file>


 


The entire file you want to upload gets base64 encoded, which produce a long string. This long string is then saved into the database. 


 


I have never tested file downloads from an API in K2, but I suspect your API will need to return the file in a format similar to what I have shown above. 


 

Dear,

 

thank you for the solution. I managed the requirment by creating a service broker to read from an API and generate the file using XML and store inside a smartobject.


regards.

Reply