POSTING a patient via rest, which is the right patientIdentifierType?

hello folks Am trying to create a patient via postman and with this url http://localhost:8099/openmrs/ws/rest/v1/patient and body

> {
>     "person": "db3a0ef7-0da8-4cd8-8580-4b90e0400386",
>     "identifiers": [
>         {
>             "identifier": "14433",
>             "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334",
>             "location": "aff27d58-a15c-49a6-9beb-d30dcfc0c66e",
>             "preferred": true
>         }
>     ]
>     
> } 

However am having issues with the patient identifierType uuid in the payload, i have used all the identifier types queried from openmrs on this GET end point http://localhost:8099/openmrs/ws/rest/v1/patientidentifiertype?v=default&limit=4 but still not yet able to post the patient

@mozzy @k.joseph @dkayiwa

What do you have in the Response payload after doing the Post ?

and what is your document type flag in postman ?

i get com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer fou - Pastebin.com

Am not getting exactly what you mean

https://rest.openmrs.org/#create-a-patientidentifier-sub-resource-with-properties @gcliff I think you can create a new patientIdentifier and then pass it person UUID to create a new Patient, this worked for me while documenting.

1 Like

sounds interesting ,thanks

1 Like

and besides , @gcliff , in our use case , i think you would want to use the FHIR API

@saurabh how do you create a new patient Identifier when the patient doesnt exist yet ??

1 Like

Creating a new *PatientIdentifier Type, sorry. Then passing in a patientIdentifier based on that type while creating a new patient. because sometimes the UUID’s I used in examples might not be present on the server for the moment, so Its better to create a new one and then use it.

1 Like

@gcliff , ideally this works.

{
  "person": "bee56eed-53e9-4243-bf0d-0562ac79e622",
  "identifiers": [
    {
      "identifier": "123AT",
      "identifierType": "7c28d370-08af-4f38-b23a-48a7951cad2d",
      "location": "b1a8b05e-3542-4037-bbd3-998ee9c40574",
      "preferred": true
    }
  ]
}

, But most probably what is causing error on your side is the Identifier Type Validator.

you either post a valid identifier as per the identifier type you referenced , or create a new Identifier Type without a validator .

And even when you create a new Identifier Type , some identifier Types are already marked as Required , so you would want to first mark the other Identifier types as not required

yeah i see they are using the org.openmrs.patient.impl.LuhnIdentifierValidator .

As you said either create a new identifier type with a validator or edit the validator in openmrs , editing the validator has worked with

{
    "person": "db3a0ef7-0da8-4cd8-8580-4b90e0400386",
    "identifiers": [
        {
            "identifier": "12345",
            "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334",
            "location": "aff27d58-a15c-49a6-9beb-d30dcfc0c66e",
            "preferred": true
        }
    ]
    
}
2 Likes

quetal yo tambien estoy teniendo el mismo problema para crear al paciente como lograste solucionar ese problema

that I am also having the same problem to create the patient as you managed to solve that problem .

Used Google Translater to understand what you where saying :blush:

2 Likes

I have the same problem when trying to create the patient I tested the uuid of the person and I did not create the patient