tfileinputraw then tRest : in order to attach a pdf file in a couchdb

Four Stars

tfileinputraw then tRest : in order to attach a pdf file in a couchdb

Hello ,
I try to attach a pdf file into a couchdb base.
First I use the tfileinputraw component with "Read the file as a bytes array"
After I want to use a tRest component.
Could you tell me what is the name of the variable which gives the content of the pdf file.
Thanks in advance
tFileInputRAw --> tRest
Four Stars

Re: tfileinputraw then tRest : in order to attach a pdf file in a couchdb

What do I put in "Corps HTTP" to load the pdf file ?
Sixteen Stars

Re: tfileinputraw then tRest : in order to attach a pdf file in a couchdb

Use a tFlowToIterate after the tFileInputRaw. This will store the byte array in the globalMap HashMap with the key "row.column" (replace row for the row name and column for the column name leaving the tFlowToIterate). Then connect from the tFlowToIterate to the tRest using the Iterate connector. Once this is connected, set the Http Body field to the value held by the globalMap. It will look something like below....
((byte[])globalMap.get("row.body"))

You will also need to set a header in the HTTP Headers section. The header name is "Content-Type" and the value will likely be "application/octet-stream".
This should work, but there is always a bit of jiggery pokery required when sending files via web service. 
Oh, the HTTP Method will likely be POST.
Four Stars

Re: tfileinputraw then tRest : in order to attach a pdf file in a couchdb

Just excuse me , i have already done this :
https://www.talendforge.org/forum/viewtopic.php?id=47378
Sixteen Stars

Re: tfileinputraw then tRest : in order to attach a pdf file in a couchdb

Did that not work? I am confused.
Four Stars

Re: tfileinputraw then tRest : in order to attach a pdf file in a couchdb

No no , it's works . Thanks