Automating DICOM Data Integration with Apache NiFi: Processing, Zipping, and Pushing to Third-Party Apps via REST API
In this tutorial, we will use MergeContent to group and compress DICOM files into a ZIP archive, then send the ZIP file to a third-party application using InvokeHTTP. This ensures efficient data transfer and integration with external systems via a REST API.

The MergeContent processor is configured here to group DICOM files and create a ZIP archive before sending it to a third-party application.
- Merge Strategy – Bin-Packing Algorithm
- This strategy groups files together based on defined limits (e.g., number of entries, size, or time) to optimize batch processing.
- Merge Format – ZIP
- The processor outputs the merged files as a compressed ZIP archive, reducing storage and transfer size.
- Attribute Strategy – Keep Only Common Attributes
- Ensures that only shared metadata among the merged files is retained, preventing conflicts when aggregating data.
- Correlation Attribute Name – PatientID
- Files are grouped based on the same
PatientID
, ensuring that each ZIP contains only data related to a single patient.
- Files are grouped based on the same
- Minimum and Maximum Number of Entries
- The processor waits for at least one file before merging and allows up to 1000 files per ZIP.
- Compression Level – 1
- A lower compression level speeds up the process while still reducing file size.
- Keep Path – False
- The original folder structure of files is not maintained in the ZIP file, simplifying the output format.
Once configured, the MergeContent processor collects incoming DICOM files, organizes them by PatientID
, compresses them into ZIP files, and forwards them for further processing or transfer via the InvokeHTTP processor.
The InvokeHTTP processor sends the ZIP file to a third-party app like XNAT using a PUT request:
- PUT is used when updating an existing file at a specific location in XNAT.
Key Configuration
- HTTP Method → PUT
- Remote URL → XNAT
- API endpoint (e.g., https://xnat.example.com/data/archive/projects/{PROJECT_ID}/files)
- Content-Type → application/octet-stream
- Send Body → true (to include the ZIP file in the request body)
- Authentication → Set headers for API key or OAuth token