Have you implemented OpenMRS? Please participate in the Implementation Site Survey. If you already have, thank you!
Page tree
Skip to end of metadata
Go to start of metadata

The two main objectives of the project were to create wrapper rest controllers over the existing HFE module and to create a simple interface to test out the new rest module


The installation is very simple just like any other OpenMRS module. The simplest way to load it is via module management in the administration section of the UI. The HFE module is a prerequisite for the same.

Brief Documentation of the APIs that were built:

API for Html Form management: (creating, viewing, editing html forms)

Url : openmrs/ws/rest/v1/htmlformentryrest/htmform?id=<html_form_id>


Expected Response:


“Id” : 1,

previewHtml” : "<htmlform formEncounterType=\"67a71486-..."





"description":"testing form via rest",











"xmlData":"<htmlform ..</htmlform>"


Note: the xmlData should have escaped “ or any other characters which might invalidate the json structure. The response will be a simple success or failure message.

List of Html Forms available in the system

Url: http://localhost:8080/openmrs/ws/rest/v1/htmlformentryrest/htmlformslist?username=admin&password=Admin123


Result shall contain a list of html form names with their ids.




“Name” = “form1”,

“id” =1

}, …





The body can be of the form as shown below which is just a concatenation of the form fields w1, w2.... etc and some other fields like personId, htmlFormId, formModifiedTimestamp, encounterModifiedTimestamp, encounterId (content type should be set to multipart/form-data)




All the same fields can be given in a json format like so: (content type should be set to Application/json as a header)



“personId”: 123,

“w1” : “abc”, ...



Shall return a body similar to below.


   "patientPersonName": "John Taylor",

   "GuessingInd": "false",

   "encounterDatetime": 1512225216000,

   "encounterId": 396,

   "patient.personId": 37,

   "encounterTypeName": "Visit Note",

   "htmlFormId": 2,

   "encounterModifiedTimeStamp": 1533570637000,

   "hasChangedId": "false",

   "htmlToDisplay": "<htmlform ...</htmlform>",

   "encounterFormName": "Visit Note",

   "formName": "Visit Note",

   "formModifiedTimeStamp": 1533563876000,

   "fieldAccessorJavascript": "propertyAccessorInfo…..",

   "encounterLocationName": "Unknown Location",

   "context.mode": "VIEW"


Deleting an Encounter related to a htmlform:

URL: localhost:8080/openmrs/ws/rest/v1/htmlformentryrest/encounter?encounterId=123

DELETE - a simple DELETE http call at the above url will delete the encounter relating to the htmlformentry.

  • No labels