What data should be sent to add a patient via REST API?

When creating a patient via REST API call what should be sent in the identifiers parameter?

Right now I’m sending in identifiers a list with size 1 of dictionary that has ID name ‘like OpenMRS ID’ and IdentifierType UUID but that fails. So any suggestions?

Your JSON should be similar to the one in this unit test:

https://github.com/openmrs/openmrs-module-webservices.rest/blob/master/omod-1.8/src/test/java/org/openmrs/module/webservices/rest/web/v1_0/controller/openmrs1_8/PatientController1_8Test.java#L94

1 Like

Thanks for your reply @wyclif

I tried that but got still getting errors of “not appropriate for validation scheme Luhn CheckDigit Validator” Is there a way to create an identifier automatically via REST APIs?

Hi @yousefhamza

As per my knowledge currently no rest call returns an Identifier (not 100% sure) :frowning:

So you can work around this problem in two ways:

  1. either include the check-digit as per Check Digit Algorithm to the identifier you are passing
  2. or remove the check digits validation in the Manage Patient Identifier types section

Note: the Check digit calculated by the link uses Luhn Mod-10 some instances of openmrs use Luhn Mod-30 so you will have to make changes respectively :slight_smile:

1 Like

You can also use IDGEN module to generate for you identifiers. @mogoodrich does IDGEN generate identifiers work for any identifier type?

1 Like

Yes, you should be able to configure it work with any identifier.

1 Like