Hello,
I don't understand your question/goal.
You can query Orthanc either using the DICOM C-Find protocol, or using the REST API of Orthanc.
For the former (DICOM networking), please have a look at the "Understanding DICOM with Orthanc" section of the Orthanc Book (you can experiment C-Find at the command-line using findscu):
For the latter (REST API), please have a look at the "/tools/find" URI:
Samples for calling "/tools/find" are available part of the integration tests of Orthanc:
At your own risk, you could also do low-level SQL relational queries against the underlying database (SQLite or PostgreSQL), but this might result in data inconsistencies or corruptions, as Orthanc implements proper locking of the database:
HTH,
Sébastien-