ioweidat
Novice

download file using service broker from an API

Jump to solution

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.

0 Kudos
Reply
2 Replies
boringNerd1
Novice

Re: download file using service broker from an API

Jump to solution

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. 


 

0 Kudos
Reply
ioweidat
Novice

Re: download file using service broker from an API

Jump to solution

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.

0 Kudos
Reply