
openmrs.js
JavaScript client library for the OpenMRS API
This library provides a way for JavaScript developers to easily access the OpenMRS API in node or the browser.
Install
npm install openmrs.js
Setup
Browser
Node
const OpenMRS = ;
Usage
💡 You will need version 2.14+
of the webservices.rest module. Currently this
requires building it from source.
const config = user: 'admin' pass: 'Admin123' url: 'http://localhost:8080/openmrs'; const o = config;const deferred = o; deferred;
You can also get help in the console:
> o.api.patient.help()
operations for the 'patient' tag
* deletePatient: Delete or purge resource by uuid
* getPatient: Fetch by uuid
* updatePatient: Edit with given uuid, only modifying properties in request
* getAllPatientIdentifiers: Fetch all non-retired identifier subresources
* createPatientIdentifier: Create identifier subresource with properties in request
* deletePatientIdentifier: Delete or purge resource by uuid
* getPatientIdentifier: Fetch identifier subresources by uuid
* updatePatientIdentifier: Edit identifier subresource with given uuid, only modifying properties in request
* getAllPatients: Search for patient
* createPatient: Create with properties in request
See the examples for further demonstrations.
API Documentation
The library code is automatically generated using swagger-js when a new instance is created, so the API available to you will depend on the version of OpenMRS you are running, and which modules you have installed.
You will always be able to see your API documentation in the OpenMRS web application
by navigating to the advanced admin screen and clicking the API Documentation
link.
Static API documentation for the OpenMRS Reference Application can be found here.
Browser Support
Development
See the OpenMRS CONTRIBUTING guidelines.
Build
npm installnpm run build
Test
npm test
Check out the npm scripts
for more stuff you can do.
Community
Support
Ask questions on OpenMRS Talk in the dev
category using the javascript
tag. Issues should be logged in the OMRSJS
project on JIRA and the component
should be set to openmrs.js
.