Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I had a niche requirement where I had to fetch a file from Salesforce and Upload it back to the IFS Document Management system (DOCMAN). I would like to explain the solution I have created here in the community so that someone could make use of it as well as whomever knows a better solution could give their feedback.
Even though it was explicitly Salesforce and IFS in my case, you might have the same scenario between other applications. Here the focus is on fetching a file (especially non-txt format) via REST API as a binary (Stream file type) and sending it back to another REST API.
I would really appreciate it if you could go through my solution and give your feedback if this is good or if there is a better solution only using talend components
Scenario:
Components Available to use and issues I faced with each component:
Summary:
Below are some screenshots from the job for a better understanding:
tFileFetch:
tFileFetch Parameter to access the cached data:
tJavaRow calling the Java Routine and converting the file data from InputStream to a byte[] array:
Java Routine:
Thanks for sharing. This is a nice way of demonstrating that no matter the requirement, there is always a way with Talend......even if you need to write a little Java. You can send files using a content type of "multipart/form-data", but the API you are calling needs to support that. I see the issue you have had here and maybe the tRestClient can be adjusted to make this easier. But as I said, this is a great workaround and easily followed by anyone else who may want to do this.
Thanks for sharing. This is a nice way of demonstrating that no matter the requirement, there is always a way with Talend......even if you need to write a little Java. You can send files using a content type of "multipart/form-data", but the API you are calling needs to support that. I see the issue you have had here and maybe the tRestClient can be adjusted to make this easier. But as I said, this is a great workaround and easily followed by anyone else who may want to do this.
Hello rahll!
Thanks for your feedback and suggestions! Yes, I tried multipart/form-data as well but, as you said, it seems the API is not supporting it.
I too wish that it would be nice to have this included in tRestClient. Till then, someone could find this post useful 🙂
Thanks!