Combined End Point for Creating a Person and Patient.

Currently, the available implementation with the OpenMRS Rest API module creates patients but using two different endpoints

  • /ws/rest/v1/person for a person and then /ws/rest/v1/patient to add he patient attributes, so need to call two different endpoints for a single operation.

Is there a way I can create a patient but using one endpoint providing all the details required for patient registration for example

         "identifier":" 103VWY7",

1 Like

Is this test good enough for you to learn how to create both a person and patient using one REST call? at 2.33.0 · openmrs/ · GitHub

@dkayiwa thank you for this feedback, I have tried the approach suggested and here is my post body.


Unfortunately the body is not being posted. This is the error that i get

"message": "[identifiers on class org.openmrs.Patient]",

I am using the patient endpoint.

Check your server side log for the actual cause of the failure.

@dkayiwa this is the error log i am getting

You do not have a patient identifier type matching the uuid that you have given.

@dkayiwa thank you so much for the help, the location type uuid was the one missing out, setting it to the correct uuid works fine.

Now on to the issue of dealing with duplicates. How can i ensure that we do not register a patient from the mobile app that already be existing in the system.

Is it also possible to change the documentation here OpenMRS Docs so as to reflect how a patient can be created along with a Person object?

Can you create a ticket for this?

How do you tell that a patient already exists? When the family name matches? Age? Gender? Or what?

@dkayiwa the ticket has been created here [RESTWS-883] Documentation for the Patient Rest API end point - OpenMRS Issues

As for patient duplicity, we are wondering whether some form of pattern matching in the names can be done as it is done withing OpenMRS.

You can use this API: openmrs-core/ at 2.5.0 · openmrs/openmrs-core · GitHub

1 Like

Thank @dkayiwa this will help us greatly.

I have taken up this ticket on JIRA. I have a few questions:

  1. What exactly is an identifier. Is it is an unique id given to a patient? What is location and identifier type?
  2. How is POST /patient/:target_patient_uuid/identifier a create Patient endpoint? Shouldn’t it be an update Patient endpoint? Am i missing something here.
  3. If the endpoint in 2 is also a way to create a patient, Is the method of Creating a patient and a person simultaneously a third way to create a new patient?
  4. What endpoint did u POST to? is it . POST /patient


  1. An identifier is a unique identification assigned to a patient that belongs to different identifier types, examples include, OpenMRS IDs, ART Clinic numbers and the likes, as for locations, these can be looked at service areas or points at which the patient is registered.

  2. The end point that needs clear documentation is /ws/rest/v1/patient. This is the endpoint for creating a patient.

  3. There is only one way to create a patient, what is not clear is that the documentation available only talks about converting an existing person into a patient. This needs to be cleared. The documentation must indicate how I can have both, a person and a patient in the POST body.

  4. Refer to 2 for the endpoint.

Thank you. One more question before I can update the docs.

The end point /ws/rest/v1/patient has 2 ways in which data can be passed to it.

One way is as described in the current documentation, where we convert an existing person into a patient.

The other way is as described in this topic where, The post body can have both the person and patient details.

Am I Correct?

How do I update the documentation? Is there an article / topic where I can find the steps that I need to follow to get access to updating the documentation?

@ganeshdagadi the steps to get started on this process are documented on the github repo here GitHub - openmrs/openmrs-contrib-rest-api-docs: OpenMRS REST API documentation. Create a pull request that will be reviewed and then merged once it has been approved.

I tried to follow the file on the github repo to serve a local version of the documentation. However, when I run the command

docker run --rm --name slate -v $(pwd)/build:/srv/slate/build -v $(pwd)/source/ -v $(pwd)/source/includes:/srv/slate/source/includes -v $(pwd)/source/images/logo.png:/srv/slate/source/images/logo.png -p 4567:4567 slatedocs/slate serve

as instructed, I get an error stating

docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.

I have cloned the repository. Docker seems to be working fine, as I checked it using the hello-world docker example.

Am I missing something or is there something wrong with the command?

In this case, @dkayiwa can help in getting you started.

A small update. I tried to fix the problem and was able to start the server, but the default slate documentation is being displayed and not the OpenMRS version. More details in this topic

This is my first time working with JIRA. I have opened a Pull request, set the status to code review and designated @solemabrothers as the designated reviewer. @solemabrothers reviewed my PR and gave a suggestion, which I have updated. What is the next procedure? Should I set status to committed code? Whom should I designate as the committer? Thanks.

Click code review for any reviewer to check the pull request . Dont forget to attach the pull request on the ticket.