tRESTRequest file upload

One Star

tRESTRequest file upload

Hi,
1) With Talend ESB 5.4. (e.g. also with TOS4ESB) you can use the tRESTRequest component to upload binary data into a byte array which you then can use in other tXX components. But keep in mind that the file you upload is hold in memory on the REST provider, means you need to be sure about the max. size and the memory consumption on the provider. But for smaller files it might be ok. E.g. upload a profile image to a new user account in a single rest call with the meta data and the picture (as binary) of the person. 
2) using a Route with cHttp and cFile to get the file content via standard HTTP and save it to a local file directly which you then might run a scheduled DI Job on or you directly call the tXXX components from the route to further process the file with cTalendJob.
Dietmar

According to the suggestion in http://community.talend.com:80/t5/Design-and-Development/resolved-Could-not-create-the-Java-virtual-..., May I know how to achieve file upload using tRESTRequest component?
Community Manager

Re: tRESTRequest file upload

Hi
Read the file and convert it to binary (byte[]) data, and pass a byte array via tRestRequest to webservice server. In server side, read this byte array and convert it to local file or store it to database. You can refer to the following article to know how to read a file and convert it to a byte array.
https://help.talend.com/pages/viewpage.action?pageId=190513201
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: tRESTRequest file upload

Hi Shong
May I know how tRestRequest receive a byte array? Is it set the body in schema as "byte[]"?