Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
hamdi_bourbia
Partner - Contributor

Upload of a CSV File using tRestClient HTTP PUT method : HTTP 411 Length Required error

Hi,

I need to upload a CSV File using HTTP PUT method. I'm using the tRestClient component, as recommended for deployment to Talend Runtime. As of now, I'm stuck with the HTTP 411 "Length Required" error. Here is my job :

0695b00000JO1drAAD.png

0695b00000JO1dwAAD.png

0695b00000JO1e6AAD.png

0695b00000JO1eGAAT.png

0695b00000JO1eaAAD.png

0695b00000JO1fnAAD.png

0695b00000JO1iDAAT.png

I tried with Postman and the PUT request works successfully :

curl -L -X PUT [confidental url] -H 'Content-Type: text/plain' --data-binary '@/C:/Users/VO2GROUP/Documents/tmp/test_202109301856.txt'

I would prefer to avoid using other components like tFileFetch

(apparently deprecated in studio version 7.3),

tRest (unadvised for deployment to Talend Runtime

cf. https://help.talend.com/r/fr-FR/7.3/rest/trest)

or thttprequest.

Would you please have a solution using the tRestClient component, with PUT method, and a CSV input file to be uploaded ?

Best regards

Labels (2)
6 Replies
hamdi_bourbia
Partner - Contributor
Author

in addition, the PUT method is not supported by the tFileFetch or tHttprequest components (studio v7.3).

hamdi_bourbia
Partner - Contributor
Author

here is the API documentation :

https://developers.files.com/#file-uploading

I'm currently stuck at step 2 (the PUT method to upload the file)

hamdi_bourbia
Partner - Contributor
Author

updates on my latest trial, I have :

1/ changed the type of the input file to document (in tConvertType) and linked it to the body (instead of the string) of the PUT request (in tMap)

2/ changed the content type in the tRestClient to text/plain. Not in the header definition, but directly in the basic settings (I used Jobscript editor, the value is not natively supported, but it runs and that is what I have in Postman)

3/ also added the content type to text/plain in the header (tRestClient > advanced settings)

Could use a little help, please.

Best regards

hamdi_bourbia
Partner - Contributor
Author

Hi,

can someone help me please ?

Regards

powerchip
Contributor

Hello,

did you manage to send a file with tRESTClient and the PUT method.

 

I've looked through the community but haven't found anything conclusive.

Since I have to send the file with the PUT method, I can't use tFileFetch.

 

On my side also works with Postman/CURL

powerchip
Contributor

Finally I did a bit of digging, I'm not java developper, but I managed to upload an image trought the PUT method with a tJava

 

0695b00000OAF28AAH.png 

In the LibraryLoad :

  • httpmime
  • commons-logging
  • httpcore
  • httpclient

 

The tJava (HttpGet) is a poc to test the imports and the get (source : https://mkyong.com/java/apache-httpclient-examples/)

The last tJava (HttpPut) is the thing

 

Basic settings

0695b00000OAF6AAAX.png 

Advanced settings

0695b00000OAF6ZAAX.png