Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How can I upload a file to REST API?

I am trying to invoke a REST API to load data to a third party provider. My payload should include the csv file itself and data mapping wrapping in a json message. The following CURL command works fine in uploading the file, but I can't seem to make this work in Talend:
curl -v -X POST -H "Content-Type: multipart/form-data" -H "loginName: thisismylogin@name" -H "appOrgId: thisismyorgID" -H "accessKey: thisismysecretaccesskey" --form "file=@" --form 'metadata={"collectionName":"data_load_a83082482aeb4fc58d75bc7f4ee1ade1","dataLoadOperation":"INSERT","mapping":,"sourceType":"FILE","headerRow":true,"fieldSeparator":",","escapeCharacter":"\\","quoteCharacter":"\"","dbNameUsed":true,"invokedFromGDM":false};type=application/json' -k
This curl command sends the file with a json message defining what the file looks like, and third party api loads the file. I couldn't figure out how I could configure this on Talend. Which component I should be using? (tRest?) And if it is tRest, what's HTTP body should look like? Any help is very much appreciated. 
Labels (5)
1 Reply
Anonymous
Not applicable
Author

Hi,
Have you already checked component tRestClient to post a request with your json format?
Here is the component reference:TalendHelpCenter:tRESTClient
Best regards
Sabrina