Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi to all! I want to build a webservice in Talend able to receive json and file at the same time. I am using the following call in python:
import requests
url="http://localhost:8088/trial"
data = {
'var1' : 'this',
'var2' : 'that'
}
headers = {'Content-Type': 'application/json'}
files = {'document': open('C:/Users/User/Desktop/Data/Talend/Mail/sample.pdf', 'rb')}
r = requests.post(url, files=files, data=data, headers=headers)
print(r.status_code)
Below a screenshot of the job in Talend:
The Issue is that inside my Talend job i am unable to retrieve the values from 'var1' and 'var2' because they arrive as multipart/form-data. How can I fetch them in my tJavaRow_1? Any suggestion about that?
Thank you in advance!
HI could you send us the component view of the tRestRequest? You can choose Produces JSON in the parameters of the tRestRequest and after use a tExtractJSONFields to fetch the JSON.
Send me love and Kudos
Hi gjeremy ! Thank you for answering my question. Here's a pic of the tRestRequest as you asked .
I've already tried the solution that you suggest but it didn't work in my case. On this purpose I want to show you how the data arrives in the first tLogRow_1.
p.s the payload in tRestRequest has byte[] as datatype.