Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Swiip
Contributor
Contributor

tRestClient call of api to get a picture

I use the tRestClient component to execute a GET on an API to get a picture in the answer.

I tried with Postman and i got a binary file with the extension ".bin".

If i rename this file with the extension ".jpg" i can see the picture.

But in Talend with tRestClient i can't generate the correct picture.

I tried to do this :

tRestClient => tmap => tFileOutputRaw

In the tmap i choose only the string (and not statusCode and body). In the tFileOutputRaw i generated a file. But it's not a picture. The size of this file is 24 ko. And with my test on Postman the size of the file is 25 ko. If i rename the file generated with the extension ".jpg" it isn't a picture.

Thank you very much for your help.

Have a good day

Labels (3)
45 Replies
gjeremy1617088143
Creator III
Creator III

maybe try to use all the header parameter postman use for the call and see what you have in encoding format response without JVM encoding force.

gjeremy1617088143
Creator III
Creator III

Hi, I think you can use tfileFetch component instead of tRestClient component. It will write directly the response into a file.

Swiip
Contributor
Contributor
Author

I just tried and it's ok with the tFileFetch component.

Thanks for all your messages and your help. Thank you very much.

Not applicable

Hello, I have the same problem as yours'. The authentication of API is Bearer token, not use+password, I couldn't use tFileFetch to get the picture. Do you have an idea?

Thanks a lot.

 

gjeremy1617088143
Creator III
Creator III

Hi , have you tried to add a header parameter :

key : "Authorization" value : "Bearer " + your token

?

Send me Love and Kudos

Not applicable

Yeah then when I execute, I got this error "Exception in component tFileFetch_1 (...)

java.lang.Exception: Method failed: HTTP/1.1 405 "