Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

having issues using tRestClient or tRest component to upload a file

I have the need to upload a binary file to a RESTful webservice where the REST service has the following signature in Java:
@POST
@Path("/uploadFile")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response uploadFile(
@FormDataParam("file") InputStream uploadedInputStream,
@FormDataParam("file") FormDataContentDisposition fileDetail) {

However, I am not able to get this to work with the tRestClient component or the tRest component.
Any help would be much appreciated.
currently, I am using "Talend Open Studio for Data Integration 6.1.0.20151029_1337"
I have control over the REST service, so changing the method parameters is possible.  All I need to capture is the binary file and its name.
Labels (4)
5 Replies
Anonymous
Not applicable
Author

Hi,
How did you set your tRestClient component? What's the error you are getting?
Have you checked the scenario in component reference:TalendHelpCenter:tRESTClient?
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi,
I also have same scenario. I want to upload files/images by using tRestClient/tRest component.
I have successfully uploaded files/images by using POST man client. But by using tRestClient/tRest components I am not able to upload file. I have gone through documentation of components.
I also tried with tFileFetch component.
I want to know where I can provide file name . Because my API signature contain one parameter i.e file.
Please have screen shot of POST man Request.
pkrivens
Contributor
Contributor

I had to call an HTTPS POST API using  Content-Type: multipart/form-data to send some parameters, post a json file and receive the response.  Nothing I tried with tREST or tRESTClient worked.  
Talend Support suggested tFileFetch to upload the file.  I saw nothing in the tFileFetch documentation which indicated I could get the response from the API call, so I never tried it.
I did get it to work using tFileFetch.  It turns out the API response is provided in the destination filename (wasn't expecting that). 
Anonymous
Not applicable
Author

Hi,
I did get it to work using tFileFetch.  It turns out the API response is provided in the destination filename (wasn't expecting that).

Do you mean the API response is loaded into your destination file(tFileFetchDownloadFile.txt) or the API response is saved as  destination  file name(APIResponse.txt)?
Could you please give us the screenshot of your API response which will be helpful for us to understand your problem.
Many thanks!
Best regards
Sabrina
pkrivens
Contributor
Contributor

Hi Sabrina,
I meant the API response is loaded into the destination file(tFileFetchDownloadFile.txt).
There is no problem at this time.