REST to access patient data

I’m designing a REST client which consumes the OpenMRS REST architecture to fetch patient details and display it in form of a summary page.

After going through wiki on REST Web Services module and I’ve learnt about how to exploit various resources using REST. So far, I’ve been able to fetch basic details about patient using REST calls: name, address and other person attributes that were collected as a part of patient registration.

I’m having trouble devising REST calls to extract the following patient information:

  1. Visits
  2. Encounters
  3. Observations, etc.

Basically, I’m trying to extract all the information about a patient that’s displayed on clinicianfacing and patient dashboard page using REST.
Digging down the wiki on REST I found no particular set of REST calls to extract the above information for a specific patient providing a unique identifier or something.


Thanks @pascal for a quick reply. Seems I didn’t explain my issue well.

I clearly understand fetching details of a particular resource by its uuid: GET /resource/{uuid}.

The point where I’m struggling is at the time of making REST calls initially, I only have the patient details in form of JSON and nothing else (no uuid for visits, encounters and observations).

Is there a possible way in which I can fetch these details based on patient uuid or patient details as parameter to the resource request (something like /resource?patient={patient}) ??

Right now the docs are not generated perfectly for resources that don’t implement SearchHandlers, see:

However, based on the VisitResource code, you should be able to do:

GET /visit?patient=uuid

The GET operation for the Encounter and Obs resources both document the patient query parameter:


The description of the parameter could be better, but you can do:

GET /encounter?patient=uuid


GET /obs?patient=uuid

It basically depends on if the resources you want to fetch support fetch by patient operations, looking at the encounter, obs and visit resources, I actually do see that they do support get by patient, you need to specify the patient request parameter and the value is the patient uuid, but it means you need to make 3 other rest calls one for each.

1 Like

Thanks @pascal and @wyclif for the direction. Will try out the above suggestions and report in case of further queries :slight_smile:

@wyclif and @pascal. Is there a way to fetch person/patient by personattribute using REST??
For instance, fetching person details using his/her telephone number.

I believe that should be possible as of 1.11.x as long the person attribute is marked as searchable, below is how the rest call would look like


1 Like

Thanks @wyclif. The above REST call works for both patient and person resource to access various person attributes .