Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to use Apache Nifi to upload/send file to rest api/server using 'multipart/form-data' ?

How to use Apache Nifi to upload/send file to rest api/server using 'multipart/form-data' ?

Rising Star



I am trying to use Apache NiFi InvokeHTTP processor to send/upload file and json to Rest API.

I am able to send file using POSTMAN (screen shot attached below).


But in NiFi I could not find any way to attach file in request, so I tried forming request body manually with json data and file content, but getting below error -


Request header :-

Content-Type:multipart/form-data; boundary=12345

Request body :-

Content-Disposition: form-data; name="dataFields"\r\n
Content-Type: application/json; charset=utf-8\r\n
{"subtaskId": "task123",
“requestRefId": "request456",
"firstName": "Mahendra",
"lastName": "Hegde"
Content-Disposition: form-data; name="file"; filename="file1.csv"\r\n
Content-Type: text/csv\r\n



Error respone :-

{"errors":[{"title":"Error extracting message data [missing file object].","detail":"Error extracting message data [missing file object].","code":"ERROR_INTEGRATION-MANAGER_DECODE_ERROR"}]}


Screenshot 2019-12-01 at 3.04.51 PM.png


Anyone knows how to use InvokeHTTP for multipart?








Don't have an account?
Coming from Hortonworks? Activate your account here