Encounter Rest API End Points

I am trying to post an encounter body from #UgandaEMRMobile for an HTS Encounter using the endpoint

(http://localhost:9090/openmrs/ws/rest/v1/encounter)

Below is the JSON Body from UgandaEMR Mobile

{
    "encounterDatetime": "2021-03-23 00:00:00",
    "encounterProviders": [
        {
            "encounterRole": "240b26f9-dd88-4172-823d-4a8bfeb7841f",
            "provider": "b815e703-c4b6-11e7-be6c-e0071bff0578"
        }
    ],
    "encounterType": "264daIZd-f80e-48fe-nba9-P37f2W1905Pv",
    "form": "b5c62a98-84d3-43e8-a9be-972185070dd4",
    "location": "841cb8d9-b662-41ad-9e7f-d476caac48aa",
    "obs": [
        {
            "concept": "46648b1d-b099-433b-8f9c-3815ff1e0a0f",
            "obsDatetime": "2021-03-23 00:00:00",
            "person": "5d83f853-2c04-4238-8efe-b54a95a0cd31",
            "value": "4f4e6d1d-4343-42cc-ba47-2319b8a84369",
            "valueCodedName": "HCT Delivery Model"
        },
        {
            "concept": "ff820a28-1adf-4530-bf27-537bfa9ce0b2",
            "obsDatetime": "2021-03-23 00:00:00",
            "person": "5d83f853-2c04-4238-8efe-b54a95a0cd31",
            "value": "74120d00-5483-4148-acc3-00647dc13add",
            "valueCodedName": "HTS Approach"
        }
    ],
    "patient": "5d83f853-2c04-4238-8efe-b54a95a0cd31",
    "visit": {
        "patient": "5d83f853-2c04-4238-8efe-b54a95a0cd31",
        "startDatetime": "2021-03-23 00:00:00",
        "stopDatetime": "2022-07-28 23:59:59",
        "visitType": "2ce24f40-8f4c-4bfa-8fde-09d475783468"
    }
}

I am, however, getting an error here Encounter Rest API End Point Error · GitHub and I can’t seem to find what the problem is.

Any assistance is appreciated. @dkayiwa @mozzy @slubwama @ssmusoke

@solemabrothers Can you provide a public end-point that can be used to test out and validate the error you are facing?

Can the public UgandaEMR demo work for this?

@ssmusoke here is the public end point http://aijar.mets.or.ug/ugandaemr/ws/rest/v1/encounter

@solemabrothers , Looks like youre using a wrong HTTP method ie you could be doing GET instead of a POST

screen shot when i do a GET

screenshot when i do a POST

you see the error is different. The former is because i was using a wrong HTTP method , the later is because probably the patient i posted doesnt exist in the instance

In you error Log , theres a line org.openmrs.module.webservices.rest.web.v1_0.controller.MainResourceController.get(MainResourceController.java:209)

so definately you were using a GET on a wrong endpoint