- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How get image and correct json file in apache NiFi using post-request?
Created on ‎01-10-2022 07:06 AM - edited ‎01-10-2022 10:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to send a file in jpeg format and a json string in post-request. Screenshots below
 By sending this request, I get an incorrect data display and an incorrect type in NiFi (This works even if the application/json or image/jpeg type is explicitly specified). Below you can see the name of the mime.type attribute for two flow files. In theory, application/json and image/jpeg should have been written here.
 
 and
 
 
And the contents of the JSON file are displayed as follows:
Is there any way to make sure that the file type is displayed correctly, and we can see the contents in json file?
Created on ‎01-14-2022 02:31 AM - edited ‎01-14-2022 02:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As per my experience, the issue you faced could be the content-type(multipart/form-data;boundary...) is not officially supported by content-viewer page's engine.
It does support Content-Type (such as application/json, application/xml, text/plain etc.) in original/formatted mode. Other types can be viewed via hex mode.
Directly supported Type under original mode:
1. application/json
2. application/xml
3. text/plain
Note: you may also append the charset encoding to the specified content-type.
e.g. application/json;charset=utf-8
WORKAROUND
1. You can try to put an UpdateAttribute Processor
(Configure it with an attribute "mime.type" along with the supported Content-Type listed above, specifying this attribute would not change the actual content, it just tells the content-viewer to depend on such way to parse and display the flowfile's content. )
2. View the flowfile's content via Hex mode.
Hope this helps, and feel free to contact me if you have any questions.
Thanks
