Search condition or patient diagnosis via REST API

I’m trying to search for a condition or diagnosis by patient via the REST API (ref app 2.12, rest module 2.32). I just get empty results.

I have created the patient, encounter, condition and patient diagnosis (table: encounter_diagnosis) via the REST API. I can see them in MySql. I can get the condition or patientdiagnoses via the REST API using the UUID, that works, but I get empty results when searching by patient.

Here is the Swagger docs for the GET /condition endpoint:

It specifies a ‘q’ parameter, but I’ve tried everything in that field, I always get empty results:

    "results": []

I assumed that it takes the patient name. I’ve tried all forms of that, also any patient identifier. I’ve also tried param name ‘patient’ instead of ‘q’, patient UUID instead of name, etc. No results. I have browsed the REST API and core Java code, but can’t find any tests that exercise the REST API at the HTTP level, only in code where the Patient parameter is already constructed, so no idea what to pass in for ‘q’.

How do I search for condition or patientdiagnoses by patient?

This is not implemented. But it should be very easy to add (less than a day). Feel free to create a ticket.

JIRA issue created: [RESTWS-900] Get conditions or patient-diagnosis by patient - OpenMRS Issues