Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

This module will not be the preferred REST web service module.

For a more complete list of web service methods see this module's replacement: Webservices.rest Module

Overview

What This Module Does Do

The OpenMRS REST Module provides a limited mechanism for communicating with an OpenMRS system externally as a client via Web Services. In this case, the REST Module is implemented using REST (1).

...

  • patient - get 1 or more patients by patient identifier
  • findPatient - get 1 or more patients by patient name
  • Observations - get a list of observation by submitting the patient identifier and concept id
  • Submitting an hl7 message - send the hl7 source name and hl7 message string via the HTTP PUT method
  • User - get a user by user identifier or name
  • findUser - get 1 or more patients by user roles, identifier and/or name

What This Module Does Not Do

Here's some caveats to usage of the REST Module:

  • REST is not SOAP - If you need SOAP, you'll need to write a SOAP layer on top of this module, or convert your SOAP calls to REST in your client
  • The entire OpenMRS API is not exposed here -- hopefully more of the API is exposed as time goes on
  • Calls to the API are not Audited (as far as I can tell)

Access URLs

  • /moduleServlet/restmodule/api/findPatient/
  • /moduleServlet/restmodule/json/findPatient/
  • /moduleServlet/restmodule/api/patient
  • /moduleServlet/restmodule/json/patient
  • /moduleServlet/restmodule/api/hl7
  • /moduleServlet/restmodule/api/obs?pId=patientIdentifier&cId=conceptId
  • /moduleServlet/restmodule/json/obs?pId=patientIdentifier&cId=conceptId
  • /moduleServlet/restmodule/api/user/identifierOrName
  • /moduleServlet/restmodule/json/user/identifierOrName
  • /moduleServlet/restmodule/api/findUser/identifierOrName?role=RoleName&role=OtherRoleName
  • /moduleServlet/restmodule/json/findUser/identifierOrName?role=RoleName&role=OtherRoleName

Example Usage

Info

All example URL paths are assumed to start with: http://myhost:myport/openmrs/moduleServlet/restmodule

...

Code Block
java
java
title/json/user/4
[
  {
    "addressList": [],
    "userId": "4",
    "systemId": "4-2",
    "username": "ajanthan",
    "gender": "M",
    "uuid": "c6ef8bd8-fd7e-11df-8272-0800271bba91",
    "name": {
      "givenName": "aja",
      "familyName": "bala"
    },
    "roleList": [
      "System Developer",
      "Provider"
    ]
  }
]

Resources

Tidbits

  • Calls to the REST library are restricted by the IP source address of the calling client. By default, this IP list is limited to calls from localhost (127.0.0.1). If you want to modify this list to allow other clients to call the REST layer, simply update the appropriate property in the global_property table in the database.
  • Passing connection credentials: ...

Release Notes

1.4.4.2

  • Added findUser to find users by role, name and/or id
  • Cleaned up rendering process

...