One Star

tFileFetch HTTP header

I need to get information through an HTTP GET request.
To do so, I use a tFileFetch component.
But I need to put an 'Authorization' token into the HTTP header...
Is there any way to do this ?
Thanks a lot.
Community Manager

Re: tFileFetch HTTP header

On the 'Advanced settings' tab of tFileFetch, there is a 'need authentication' option.
Best regards
Talend | Data Agility for Modern Business
One Star

Re: tFileFetch HTTP header

Thanks for your answer.
But the authentication mechanism in Talend deals with login/password.
My 'Authorization' HTTP header data is a big string, not a user/password couple.
It should looks like : Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== ... in the HTTP header...
I've tried to put my string into each of those fields but it doesn't work...
Is this authentication information will end into the 'Authorization' field of the HTTP header ?
One Star

Re: tFileFetch HTTP header

I'm dealing with the exact same issue. Anybody resolve this? I need to get the Authorization variable into the Get header.
One Star

Re: tFileFetch HTTP header

I used shong's advice, and for me it works fine.
My auth scheme a little bit more complicated:
local PC -> NTLM Proxy auth -> HTTP Basic auth -> HTTP data
One Star

Re: tFileFetch HTTP header

Probably what you have is base64 encoded... so from your example the decode command is
$ echo QWxhZGRpbjpvcGVuIHNlc2FtZQ== | mmencode -u
AladdinSmiley Surprisedpen sesame
So you login name is Aladdin and your password is "open sesame"
Have fun.
One Star

Re: tFileFetch HTTP header

I had a heck of a time getting things to work how it was described here so instead I wrote some code in a tJava component and looks like: (hopefully someone else would find this helpful)
//conn.getResponseCode() returns -1 when the making multiple calls in a loop so you need to make sure that the streams are closed and the connection is fully closed
System.setProperty("http.keepAlive", "false"); url = new; conn = ( url.openConnection();
conn.setRequestMethod("PUT");//you can specify what type of request you want to do here.... PUT, GET, POST... etc..
conn.setRequestProperty("Content-Type", "application/json");

String username = context.username;
String password = context.password;

sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder();
String userpassword = username + ":" + password;
String encodedAuthorization = enc.encode( userpassword.getBytes() );
conn.setRequestProperty("Authorization", "Basic "+encodedAuthorization);

String input = "{\"order_note\": \"Order downloaded.\",\"email_note\":Something here}";//payload to send to the server... os = conn.getOutputStream();

if (conn.getResponseCode() != {
context.log += "\r\n"+currentTS+" Client:"+context.cust_code+" Order update failed. "+conn.getResponseCode()+" and message: "+conn.getResponseMessage();
throw new RuntimeException("Orders might have been downloaded but failed to update order status at store. Failed : HTTP error code : "
+ conn.getResponseCode());
} br = new

String output;
System.out.println("Output from Server .... \n");

while ((output = br.readLine()) != null) {

conn.getInputStream().close();//be sure to close the stream OR in the while loop above make sure you read ALL the contents from the stream BEFORE closing it