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.

NiFi - Upload file using InvokeHttp POST - Unsupported Media Type error


NiFi - Upload file using InvokeHttp POST - Unsupported Media Type error

New Contributor

I am trying to upload a file using NiFi to an ASP.NET Core REST API which accepts IFormFile. The API is defined as follows:


public string UploadContent(IFormFile file)
        return uploadService.ParseFile(file.FileName, file.OpenReadStream());


I can successfully upload a file using Postman by selecting the "form-data" option for the body of the request and attaching the file. When using NiFi, I receive an "Unsupported media type" error.


I think the issue is with the values in the Content-Disposition property.

From Postman, this property has the following values:


Content-Disposition: form-data; name="file"; filename="test.pdf"
Content-Type: application/pdf


From NiFi, it has the following values:


Content-Disposition: inline; filename="test.pdf"
Content-Type: application/pdf


I have tried to add a Content-Disposition property to the InvokeHttp processor to override the values, but still receive the error.


Any recommendations on how to update the Content-Disposition property within NiFi to send the correct values? Or how to correctly configure the InvokeHttp processor to POST the flowfile to an API (I have the SendMessageBody property set to True)?





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