REST API Against Sub Tags

Good Day All,
I have a multi site environment where searching for PatientID returns nothing (it is empty). Instead there are sub tags for Patient ID’s for each site, and a global one. Does anyone know if It is possible to perform a REST Query using those tags?
In Lua I can access this tag via" tags[‘OtherPatientIDsSequence’][1][‘PatientID’] for example. I just do not know how or if it is possible to do it via REST API to a Modality. Any help would be appreciated. Thanks.

0010,1002 (OtherPatientIDsSequence): []
Item 0
0010,0020 (PatientID): PD33123
0010,0021 (IssuerOfPatientID): Hospital One
0010,0024 (IssuerOfPatientIDQualifiersSequence): []
Item 1
0010,0020 (PatientID): 4354442
0010,0021 (IssuerOfPatientID): Hospital Two
0010,0024 (IssuerOfPatientIDQualifiersSequence): []
Item 2
0010,0020 (PatientID): PD534534
0010,0021 (IssuerOfPatientID): GLOBAL
0010,0024 (IssuerOfPatientIDQualifiersSequence): []
Item 3
0010,0020 (PatientID): SR23434
0010,0021 (IssuerOfPatientID): Hospital Three
0010,0024 (IssuerOfPatientIDQualifiersSequence): []
Item 4
0010,0020 (PatientID): SD342342
0010,0021 (IssuerOfPatientID): Hospital Four
0010,0024 (IssuerOfPatientIDQualifiersSequence): []

Dear Bryan,

You can use the /instances/{id}/tags API to retrieve the full tags of the instance.
Then you will need to parse this API response, I don’t know what language you are using, anyway for example in Java gson library will parse the answer to full a JSONObject (which extends a HashMap), in PHP the support of JSON is native, the json_decode can give you an associative array of the full tag message.

In short take the full tag message with /instances/id/tags, parse the message to make a clean datastructure of the message (use JSON decoding librarie) and take your needed key from you JSON Object in memory.

Best regards,



As a complement to Salim’s answer, please note that the “/tools/find” URI currently does not support hierarchical matching (i.e. matching over sequences).

For the time being, the solution consists in looping over the “/studies/” URI (possibly after a pre-filtering with a “flat” query on “/tools/find”), then manually matching against “/studies/{id}/patient-module”.

As always, a plugin could be developed to automate this process, avoiding opening multiple HTTP successive connections to Orthanc: