Creating a new Encounter via REST

Question: We have created a mobile client for our implementation,i.e, UgandaEMR . Ideally, the mobile client must be able to sync data to and from the facility EMR provided there is a network connection. We have already worked on the synching of data from the EMR to the Mobile device, however, the challenge is sending data back to the EMR from the mobile device.

We are using the endpoint for encounters as explained here

The Post Body i.e, content to send to the EMR is here

The error message is [obs on class org.openmrs.EncounterType as shown here

I need advice on how to solve this error. Thank you. @dkayiwa @ssmusoke @wyclif @mozzy

hello @solemabrothers

sorry about the error

i see the url end point you are using is for an encountertype, if you are aiming at creating an encounter then the url should be something like this http://localhost:8087/openmrs/ws/rest/v1/encounter and the post payload probably like this

  "encounterDatetime": "2019-10-16 12:08:43",
  "patient": "070f0120-0283-4858-885d-a20d967729cf",
  "encounterType": "e22e39fd-7db2-45e7-80f1-60fa0d5a4378",
  "location": "aff27d58-a15c-49a6-9beb-d30dcfc0c66e",
  "encounterProviders": [
      "provider": "bb1a7781-7896-40be-aaca-7d1b41d843a6",
      "encounterRole": "240b26f9-dd88-4172-823d-4a8bfeb7841f"

thats why the obs attribute is not being understood on the class org.openmrs.EncounterType because the EncounterType only takes in name and description attributes …

Feel free to correct me if i have gooten your question wrongly :cowboy_hat_face:


1 Like

@gcliff I need to send obs along with the encounter, running the above json body gives this error message


    "error": {

        "message": "Invalid Submission",

        "code": "",

        "globalErrors": [],

        "fieldErrors": {

            "patient": [


                    "code": "Encounter.error.patient.required",

                    "message": "Patient is Required"