Receiving all instances by serial number of the machine

I use REST API and I need to receive pictures from the server by serial number of the device. Examples of POST requests do not work for me, and if I use standard GET queries, there it is first necessary to obtain unique identifiers, then on them to request information about all the identifiers. One is a big load on the server if you run all the unique serial numbers and search with the serial number of the device. Returning to the question, you can somehow get the serial number of the device.

No, there’s no more efficient way of filtering data based on a non main dicom tag.
You might be able to make a single request per study via the /studies/{id}/shared-tags route (provided that your SerialNumber is identical in all instances of your study)

Otherwise, maybe you might want to have a look at the mongoDb plugin where you might be able to make deeper queries from the mongoDb database directly … (disclaimer: I’m really not familiar with this plugin: https://github.com/Doc-Cirrus/orthanc-mongodb)

Hello,

Here is a sample REST API call to find the Orthanc identifiers of all the DICOM series generated by an imaging modality whose “Device Serial Number (0018,1000)” DICOM tag is equal to “123”:

curl -X POST http://localhost:8042/tools/find -d ‘{“Query”:{“DeviceSerialNumber”:“123”},“Level”:“Series”,“Expand”:true}’

If you are interested by a list of several serial numbers, just separate them with backslashes:

curl -X POST http://localhost:8042/tools/find -d ‘{“Query”:{“DeviceSerialNumber”:“123\abc”},“Level”:“Series”,“Expand”:true}’

This call will provide the Orthanc identifiers of all such series in the “ID” field. You could then download all the corresponding DICOM files with a second REST API call to the “/tools/create-archive” URI:

curl http://localhost:8042/tools/create-archive -d ‘[“6eeded74-75005003-c3ae9738-d4a06a4f-6beedeb8”,“95a6e2bf-9296e2cc-bf614e2f-22b391ee-16e010e0”]’ > media.zip

As a consequence, only 2 calls to the REST API should be sufficient to meet your needs.

HTH,
Sébastien-