Patient search via REST API: exception and no results

I have installed version 2.12 of the reference application. Then I created a new patient via the web app. When inspecting the MySql database, I can see the patient, person and patient_identifier created. The latter is of type ‘OpenMRS ID’ and has value ‘10000X’. I can also see the patient’s name in patient_name table.

Then I tried to search for the patient via the REST API, but got no results when searching on that identifier or name.

Search by identifier

I used both the Swagger UI and Postman to do a GET:

http://localhost:8080/openmrs/ws/rest/v1/patient?identifier=10000X

I always get response: {"results":[]}

Search by name

I also tried searching by name, same problem: no results, e.g.:

GET http://localhost:8080/openmrs/ws/rest/v1/patient?q=kim

Exception in log

The searches generate this exception in the server log: “No converter found for return value of type: class org.openmrs.module.webservices.rest.SimpleObject”

Here is the full stack-trace on pastebin.

@cornelmasson could you search with GET http://localhost:8080/openmrs/ws/rest/v1/patient?q=kim&v=default&limit=1 and also ensure kim is the patient name in the DB with 10000X

I tried that before and still no results. I’ve searched with all values of v (ref, default, full, etc.), different limits, etc.

The patient exists in the db with that name. Below are the screenshots of the MySql table rows:

person_name

patient_identifier.

@cornelmasson could you cross check with your server endpoint.

i have just tested out a similar end point https://demo.openmrs.org/openmrs/ws/rest/v1/patient?q=abd&v=default&limit=1 on the demo server and it works fine

{
    "results": [
        {
            "uuid": "0ff88de9-1ca1-4fda-9063-9087428a7d29",
            "display": "100KK3 - abd uydgvh",
            "identifiers": [
                {
                    "uuid": "99b50bd9-cdc7-484e-94ee-a630b0e2f74c",
                    "display": "OpenMRS ID = 100KK3",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/0ff88de9-1ca1-4fda-9063-9087428a7d29/identifier/99b50bd9-cdc7-484e-94ee-a630b0e2f74c",
                            "resourceAlias": "identifier"
                        }
                    ]
                }
            ],
            "person": {
                "uuid": "0ff88de9-1ca1-4fda-9063-9087428a7d29",
                "display": "abd uydgvh",
                "gender": "F",
                "age": 10,
                "birthdate": "2012-02-12T00:00:00.000+0000",
                "birthdateEstimated": false,
                "dead": false,
                "deathDate": null,
                "causeOfDeath": null,
                "preferredName": {
                    "uuid": "b0f473a6-14a0-4fe9-b119-ac152c071659",
                    "display": "abd uydgvh",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/0ff88de9-1ca1-4fda-9063-9087428a7d29/name/b0f473a6-14a0-4fe9-b119-ac152c071659",
                            "resourceAlias": "name"
                        }
                    ]
                },
                "preferredAddress": {
                    "uuid": "334b3b16-bece-4320-bab0-d2f9d78b291f",
                    "display": "sdcjdbsnv",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/0ff88de9-1ca1-4fda-9063-9087428a7d29/address/334b3b16-bece-4320-bab0-d2f9d78b291f",
                            "resourceAlias": "address"
                        }
                    ]
                },
                "attributes": [
                    {
                        "uuid": "562b76cd-d06d-4118-8eeb-a29e5693ef4e",
                        "display": "Telephone Number = 1452564732",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/0ff88de9-1ca1-4fda-9063-9087428a7d29/attribute/562b76cd-d06d-4118-8eeb-a29e5693ef4e",
                                "resourceAlias": "attribute"
                            }
                        ]
                    }
                ],
                "voided": false,
                "birthtime": null,
                "deathdateEstimated": false,
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/0ff88de9-1ca1-4fda-9063-9087428a7d29",
                        "resourceAlias": "person"
                    },
                    {
                        "rel": "full",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/0ff88de9-1ca1-4fda-9063-9087428a7d29?v=full",
                        "resourceAlias": "person"
                    }
                ],
                "resourceVersion": "1.11"
            },
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/0ff88de9-1ca1-4fda-9063-9087428a7d29",
                    "resourceAlias": "patient"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/0ff88de9-1ca1-4fda-9063-9087428a7d29?v=full",
                    "resourceAlias": "patient"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}