Making POST requests on the SHR Adapter module

A POST request is made on the SHR Adapter module for the purpose of storing an hl7 message as an encounter in the SHR database.

The user may specify the following data in his POST request.

These data are -

Parameter

Is Mandatory

Description

patient ID

yes

The ID of the patient to whom the new encounters will be mapped

id Type

yes

The idType of the provided patient id. Currently, the only supported ID type is 'ECID'

hl7 message

yes

The hl7 message will be included in the request body. It will be in xml format.


A POST request on the SHR Adapter module is triggerd by the filing out of a form created on the POC module.

Therefore, a POST request can contain an encounter with zero or many Obs groups / Obs.

If the POST encounter is successful, and a new encounter is created, then the SHR will return an xml formatted success message to the user.

This message will look as follows - 

HTTP/1.1 201 Created
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: JSESSIONID=1l8yojhdxyuwf;Path=/openmrs
Location: http://localhost:8080/openmrs/ws/rest/RHEA/patient/encounters?enterpriseId=1234&idType=ECID&encounterId=119
ETag: "0d41d8cd98f00b204e9800998ecf8427e"
Content-Length: 0
Server: Jetty(6.1.10)

Note : The location header of the URL contains the encounter id of the newly created encounter