RESTful Patient Search

Hello, i am looking for a way to get a limited list of patients using rest service

I have tried get first nnn Patient by using GET patient api with set limit but it does not work so hopefully i could filter on the location or available flags.

Thanks
Tim

What exact filtering criteria do you want to use? Many are listed in the API docs.

It is not possible to list all patients, so you need to specify one of the q or identifier parameters. If you do that, then the limit and startIndex parameters will work. For example, the following is successful:

curl -u admin:Admin123 -X GET --header 'Accept: application/json' \
'http://uat02.openmrs.org:8080/openmrs/ws/rest/v1/patient?q=john&limit=10'

Edit: As far as I’m aware, patients are not associated with locations, so I don’t think you’ll be able to filter on that.

Hi Pascal, thank you for your help again. could i filter on the person instead? are there other ways to query the database? I do not have much knowledge with the underlying tables.

thanks Tim

What exactly are your search criteria?

Pascal, I used “Visit” api to get a list of patients. I would still need help with doing more advance queries. will need your help again later.

Thanks, Tim

This is not supported, patients are not associated to locations

1 Like