Custom media download filenames

Dear all,

One feature I’m very much missing in the REST API of Orthanc is the possibility to set custom filenames for when archives are created and downloaded via HTTP/HTTPS. By default, the downloaded files (e.g. by /media) will be {OrthancID}.zip, which is fine for administrators and developers but in my opinion of little use to the end-user because an end-user typically identifies any data by something like the PatientID and not the internal OrthancID.

I would thus like to propose a small modification of the Archive REST API that adds an optional parameter by which the filename of the download can be specified within the HTTP query/link.

A typical use case would be when Orthanc is integrated or used as a backend in any custom web interface. The web interface could offer to the user adjusted download links so that the files downloaded from Orthanc are named by anything the web interface can include as additional information (could be just numbered, e.g. data01.zip, data02.zip or other metadata like {PatientID}.zip). How the files are named would not be part of Orthanc but Orthanc would just offer the possibility to overwrite the filenames via the REST API.

A simple example would simply look like this:
https://127.0.0.1:12345/patients/c07d7fd4-af95f480-59c448fa-a50b3d28-a613aa70/media?filename=Data01.zip

Attached please find a diff for how to implement this in Orthanc, it’s a rather small change and should not be able to break anything. In my opinion, adding this functionality would make Orthanc even more flexible when used as a backend in any web-based DICOM system.

best wishes
Martin

OrthancFileNameDiff.txt (1.7 KB)

Dear Martin,

Thanks for suggesting this simple, yet interesting feature.

I have just submitted an adapted version of your patch into the mainline of Orthanc:
https://hg.orthanc-server.com/orthanc/rev/48b53ac404d9

Kind Regards,
Sébastien-

Thank you very much for including this so quickly!