Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to use tREST to upload/update files. I could use tFileFetch. But, that supports only POST, not GET and PUT.
How can I pass the filename in the body and also how to pass the username/password authentication credential (the Basic authentication)?
Appreciate your help.
Thanks
You can use a global variable "FileName" to store the filename and then in the body just do: (String) globalMap.get("FileName")
To use basic authentication add a HTTP Header as follow
name: "Authorization"
value: "Basic urlEncodedText"
The urlEncodedText would be [user]:[password] url encoded
To get the encoded text you can run this java code in one of the online java sites as: https://www.compilejava.net/
import java.util.Base64;
String str;
str = "[user]:[password]";
str = Base64.getUrlEncoder().encodeToString(str.getBytes());
System.out.println("encoded value is " + str);
Hope it helps
Thanks, dbeltritti.
I tried tREST with the settings as shown below. But its not working. Am I doing something wrong here?
I am trying to upload jpg images.
That will post the file path, no the actual file content. Do you want to post the actual file through a rest service?
Yes, I want to upload jpg files (want to use POST and PUT).
Thanks,
Hi,
The below article is calling REST service to load a png file. It will require some custom code but this should help you to perform your task to upload image files. Could you please try it?
http://talend.nl/talend-tech-tip-calling-a-rest-service-for-file-upload/
Warm regards,
Nikhil Thampi
Nikhil, thanks for the suggestion. But this doesn't work for me. I followed the article, but it throws bunch of compilation errors even with the jars uploaded.
As I mentioned before, I am able to upload file using "POST" in tFileFetch. Now, I also need file "PUT" option. Are there any other options to accomplish that?
Appreciate the help.
thanks man.
Thanks, @francispandey.
I am actually using tFileFetch to POST a file. That works fine. However, I also need option for "PUT" method. tFileFetch supports only POST.
Any other suggestion?