Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I'm retreiving a file in base64 from a route and trying to send it to an API through the component tRestClient. I convert the base64 into a file without any issue but i struggle to send it on the API
I don't understand how to use it. I tried to put the complete path of the file into a query parameter with no success.
Here is what i've done :
I'm really not sure how to do it. I can't use a tFileFetch because my API is waiting for 3 parameters: file, type and fileName
I'm used to send body messages with JSON but i don't understand how use it to send a file.
Thanks for the help!
Hi everyone,
I finally succeeded by modifying the component tFileFetch.
The API was sending me a 201 response so i had to modify the code of the component to accept this code as a valid response:
status_<%=cid%> == org.apache.commons.httpclient.HttpStatus.SC_OK<%= scaccepted_uploadfile%>
became
status_<%=cid%> == org.apache.commons.httpclient.HttpStatus.SC_OK<%= scaccepted_uploadfile%> || status_<%=cid%> == org.apache.commons.httpclient.HttpStatus.SC_CREATED<%= scaccepted_uploadfile%>
I have now a new issue related to "Method failed: HTTP/1.1 413 Request Entity Too Large"
But not related directly to that topic
Hello,
If a file data needs to be passed to trestclient as query parameter then the string has to be created with all the columns of file in json format as we have string column in output schema. Also body column needs to be created with documnet type as the below screenshot.
Then pass the result to restclient and refer below screenshot for your reference
The schema of response has to be configured as given above
Regards,
BhavikaW
Hi Bhavika,
Thanks for the reply but I'm trying to send a PDF so i can't read it
akumar,
Thanks for the answer, but the link http://talend.nl/talend-tech-tip-calling-a-rest-service-for-file-upload/ isn't working
My issue is that i have to send data in the same time i need to send the file. I tried to not putting them, it works with a POSTMAN but not in Talend and i don't know why. I tried to put them in the "Parameters" section of the tFileFecth, always getting this message :
There isContinue_tFileFetch_1 an exception on: MY_API
java.lang.Exception: Method failed: HTTP/1.1 201 Created
Any idea?
Hi everyone,
I finally succeeded by modifying the component tFileFetch.
The API was sending me a 201 response so i had to modify the code of the component to accept this code as a valid response:
status_<%=cid%> == org.apache.commons.httpclient.HttpStatus.SC_OK<%= scaccepted_uploadfile%>
became
status_<%=cid%> == org.apache.commons.httpclient.HttpStatus.SC_OK<%= scaccepted_uploadfile%> || status_<%=cid%> == org.apache.commons.httpclient.HttpStatus.SC_CREATED<%= scaccepted_uploadfile%>
I have now a new issue related to "Method failed: HTTP/1.1 413 Request Entity Too Large"
But not related directly to that topic