I am having a hard time correlating which documentation is correct and which one should be followed.
For example when creating an encounter the bundled documentation in OpenMRS shows this
{
"patient": {
"person": "uuid",
"identifiers": [
{
"identifier": "string",
"identifierType": "uuid",
"location": "uuid",
"preferred": true
}
]
},
"encounterType": {
"name": "string",
"description": "string"
},
"encounterDatetime": "string",
"location": {
"name": "string",
"description": "string",
"address1": "string",
"address2": "string",
"cityVillage": "string",
"stateProvince": "string",
"country": "string",
"postalCode": "string",
"latitude": "string",
"longitude": "string",
"countyDistrict": "string",
"address3": "string",
"address4": "string",
"address5": "string",
"address6": "string",
"tags": [
"string"
],
"parentLocation": "string",
"childLocations": [
"string"
]
},
"form": {
"name": "string",
"description": "string",
"version": "string",
"encounterType": "string",
"build": 0,
"published": true,
"formFields": [
"string"
],
"xslt": "string",
"template": "string"
},
"provider": "string",
"orders": [
{
"encounter": "uuid",
"orderType": "uuid",
"action": "NEW",
"accessionNumber": "string",
"dateActivated": "string",
"scheduledDate": "string",
"patient": "uuid",
"concept": "uuid",
"careSetting": "uuid",
"dateStopped": "string",
"autoExpireDate": "string",
"orderer": "uuid",
"previousOrder": "uuid",
"urgency": "ROUTINE",
"orderReason": "uuid",
"orderReasonNonCoded": "string",
"instructions": "string",
"commentToFulfiller": "string"
}
],
"obs": [
null
]
}
However the https://rest.openmrs.org/?shell#list-encounters shows the following
POST /Encounter
{
"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"
}
]
}
The difference in case /encounter in REST and /Rest in documentation is glaring.
IMO maintaining manual documentation is a very big pain point especially with tools that can generate documentation from OpenAPI (formerly Swagger)
UPDATE: So why does this matter the JSON request from the documentation (below)
{
"encounterDatetime": "2020-07-16 12:08:43",
"patient": {
"person": "8f158fad-1469-42e2-9798-b9f5de225240"
},
"encounterType": {
"uuid": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f"
},
"location": "aff27d58-a15c-49a6-9beb-d30dcfc0c66e",
"encounterProviders": [
{
"provider": "f9badd80-ab76-11e2-9e96-0800200c9a66",
"encounterRole": "240b26f9-dd88-4172-823d-4a8bfeb7841f"
}
]
}
and this also does not work
{
"encounterDatetime": "2020-07-16 12:08:43",
"patient": "378c7325-d7b8-4506-ada9-a8da199b1d3e",
"encounterType": "8d5b2be0-c2cc-11de-8d13-0010c6dffd0f",
"location": "aff27d58-a15c-49a6-9beb-d30dcfc0c66e",
"encounterProviders": [
{
"provider": "f9badd80-ab76-11e2-9e96-0800200c9a66",
"encounterRole": "240b26f9-dd88-4172-823d-4a8bfeb7841f"
}
]
}
throws the error https://gist.github.com/ssmusoke/1b2745438a564b25be47de6a0915e37c