NAV
shell java javascript

OpenMRS REST API

This documentation serves as a reference to the bespoke REST API for OpenMRS.

Purpose

Getting Started

Current version

Schema

Getting Started with examples

1. Instructions for all the examples

Java Code Stubs



import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import java.io.IOException;

public class Main {
    public static void main(String[] args) {
        try {

            // the examples go here

        } catch (IOException exception) {

            // handle exception here
        }
    }
}

2. Getting Started with Java Code samples

3. Getting Started with JavaScript Code samples

Terms

Resources

Querying a resource(Role)

GET /role?v=default&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/role?limit=1&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/role?limit=1&v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

For Instance Querying a Resource

Subresources

Accessing a Subresource under parent URL

POST /openmrs/ws/rest/v1/person/:target_person_uuid/name
{
  "givenName": "John",
  "familyName": "Smith"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"givenName\": \"John\",\r\n  \"familyName\": \"Smith\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/070f0120-0283-4858-885d-a20d967729cf/name")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=A1644AD703C71E603C4E87B79291D075")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=A1644AD703C71E603C4E87B79291D075");

var raw = JSON.stringify({"givenName":"John","familyName":"Smith"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/070f0120-0283-4858-885d-a20d967729cf/name", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Resources with subtypes

Usage Examples of Resources with SubTypes

Usage Examples of Resources(Order) with SubTypes

POST /openmrs/ws/rest/v1/order
{
  "type":"testorder",
  "action": "new",
  "urgency": "ROUTINE",
  "dateActivated": "2018-10-16 12:08:43",
  "careSetting": "INPATIENT" ,
  "encounter": "69f83020-caf2-4c9e-bca7-89b8e62b52e1",
  "patient": "96be32d2-9367-4d1d-a285-79a5e5db12b8",
  "concept": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
  "orderer": "f9badd80-ab76-11e2-9e96-0800200c9a66"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"type\":\"testorder\",\r\n  \"action\": \"new\",\r\n  \"urgency\": \"ROUTINE\",\r\n  \"dateActivated\": \"2018-10-16 12:08:43\",\r\n  \"careSetting\": \"INPATIENT\" ,\r\n  \"encounter\": \"69f83020-caf2-4c9e-bca7-89b8e62b52e1\",\r\n  \"patient\": \"96be32d2-9367-4d1d-a285-79a5e5db12b8\",\r\n  \"concept\": \"5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\r\n  \"orderer\": \"f9badd80-ab76-11e2-9e96-0800200c9a66\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/order")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=A1644AD703C71E603C4E87B79291D075")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=A1644AD703C71E603C4E87B79291D075");

var raw = JSON.stringify({"type":"testorder","action":"new","urgency":"ROUTINE","dateActivated":"2018-10-16 12:08:43","careSetting":"INPATIENT","encounter":"69f83020-caf2-4c9e-bca7-89b8e62b52e1","patient":"96be32d2-9367-4d1d-a285-79a5e5db12b8","concept":"5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","orderer":"f9badd80-ab76-11e2-9e96-0800200c9a66"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/order", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Querying Resources with subtypes

Querying Resources with subtypes (drug order)

GET  /openmrs/ws/rest/v1/order?type=drugorder&v=full

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/order?type=drugorder&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A1644AD703C71E603C4E87B79291D075")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A1644AD703C71E603C4E87B79291D075");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/order?type=drugorder&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Querying Resources with subtypes (drug order)

Authentication

Retrieve session token

Retrieve session token

GET /openmrs/ws/rest/v1/session 
  -H 'Authorization: Basic Auth <base64 encoded username:password'
    OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
    Request request = new Request.Builder()
            .url("/openmrs/ws/rest/v1/session")
            .method("GET", null)
            .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
            .build();
    Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/session", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "sessionId": "2D158E83ACFB788998C7DB495F07C1B9",
    "authenticated": true,
    "user": {
        "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
        "display": "admin",
        "username": "admin",
        "systemId": "admin",
        "userProperties": {
            "loginAttempts": "0",
            "emrapi.lastViewedPatientIds": "508,509,511,512,513,514,515,516,517,510,518,519,520,521,522,523,524,507,44,525"
        },
        "person": {
            "uuid": "24252571-dd5a-11e6-9d9c-0242ac150002"
        },
        "privileges": [],
        "roles": [
            {
                "uuid": "8d94f852-c2cc-11de-8d13-0010c6dffd0f",
                "name": "System Developer"
            },
            {
                "uuid": "8d94f280-c2cc-11de-8d13-0010c6dffd0f",
                "name": "Provider"
            }
        ]
    },
    "locale": "en_GB",
    "allowedLocales": [
        "en",
        "en_GB",
        "es",
        "fr",
        "it",
        "pt"
    ],
    "sessionLocation": null
}

Logout User/End session

Logout User/End session

DELETE /openmrs/ws/rest/v1/session -H 'Accept: application/json'
-H 'Authorization: Basic Auth' (required to identify the user)
    OkHttpClient client = new OkHttpClient().newBuilder().build();
    Request request = new Request.Builder()
        .url("/openmrs/ws/rest/v1/session")
        .method("DELETE", null)
        .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
        .build();
    Response response = client.newCall(request).execute();      

var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/session", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Changing Password

Password change By Admin

POST /openmrs/ws/rest/v1/password/:target_user_uuid 
{
  "newPassword" : "newPassword"
}

    OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
    MediaType mediaType = MediaType.parse("application/json");

    //password should contain atleast 1 integer
    RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"newPassword\" : \"password1\"\r\n}");
    Request request = new Request.Builder()
            .url("/openmrs/ws/rest/v1/password/45ce6c2e-dd5a-11e6-9d9c-0242ac150002")
            .method("POST", body)
            .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
            .addHeader("Content-Type", "application/json")
            .build();
    Response response = client.newCall(request).execute();
}


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9");

var raw = JSON.stringify({"newPassword":"newPassword1"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/password/45ce6c2e-dd5a-11e6-9d9c-0242ac150002", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Since version 2.17 of the webservices.rest module:

Password change By Users

POST /openmrs/ws/rest/v1/password 
{
  "oldPassword" : "oldPassword",
  "newPassword" : "newPassword"
}
    OkHttpClient client = new OkHttpClient().newBuilder().build();
    MediaType mediaType = MediaType.parse("application/json");

    RequestBody body = RequestBody.create(mediaType, "{\r\n  \"oldPassword\" : \"Admin123\",\r\n  \"newPassword\" : \"newPassword1\"\r\n}");
    Request request = new Request.Builder()
      .url("/openmrs/ws/rest/v1/password")
      .method("POST", body)
      .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
      .addHeader("Content-Type", "application/json")
      .build();
    Response response = client.newCall(request).execute();

var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9");

var raw = JSON.stringify({"oldPassword":"Admin123","newPassword":"newPassword1"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/password \n", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Getting all location without authentication

Getting all location without authentication

GET /openmrs/ws/rest/v1/location?tag=Login+Location' 

    OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
    Request request = new Request.Builder()
            .url("/openmrs/ws/rest/v1/location?tag=Login+Location")
            .method("GET", null)
            .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
            .build();
    Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location?tag=Login+Location'\n", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

User

User Overview

A User in OpenMRS is an account that a person may use to log into the system.

The real-life person is represented by a Person record in OpenMRS, and a person may have more than one user account. If you want a patient to be able to view her record in OpenMRS, then you need to create a user account and link it to the patient's person record.

Available operations for User

  1. List users
  2. Create a user
  3. Update a user
  4. Delete a user

List all non-retired users.

Get all non-retired Users

GET user?q=admin&v=default


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/user?q=admin
&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/user?q=admin&v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
            "display": "admin",
            "username": "admin",
            "systemId": "admin",
            "userProperties": {
                "loginAttempts": "0",
                "emrapi.lastViewedPatientIds": "19,513,323,522,523,529"
            },
            "person": {
                "uuid": "24252571-dd5a-11e6-9d9c-0242ac150002",
                "display": "Super User",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/24252571-dd5a-11e6-9d9c-0242ac150002"
                    }
                ]
            },
            "privileges": [],
            "roles": [
                {
                    "uuid": "8d94f852-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "System Developer",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/role/8d94f852-c2cc-11de-8d13-0010c6dffd0f"
                        }
                    ]
                },
                {
                    "uuid": "8d94f280-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Provider",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/role/8d94f280-c2cc-11de-8d13-0010c6dffd0f"
                        }
                    ]
                }
            ],
            "retired": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002?v=full"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

Quickly filter users with given query parameters. Add parameter includeAll=true to also retrieve disabled users. Returns a 404 Not Found status if the user does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
q Search Query Filter users by username or system ID
includeAll Boolean If true, returns also disabled users

Get user by UUID.

Get User by UUID

GET /user/:target_user_uuid

1. Here the target UUID used is of the admin user.  

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();


1. Here the target UUID used is of the admin user.  

var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a user

Create a new User using person object

{
    "username": "demoUser",
    "password": "Password123",
    "person": {
        "names": [
            {
                "givenName": "Demo",
                "familyName": "User"
            }
        ],
        "gender": "M",
        "birthdate": "1997-09-02",
        "addresses": [
            {
                "address1": "30, Vivekananda Layout, Munnekolal,Marathahalli",
                "cityVillage": "Bengaluru",
                "country": "India",
                "postalCode": "560037"
            }
        ]
    },
    "roles": [
        {
            "name": "Configures Forms",
            "description": "Manages forms and attaches them to the UI"
        }
    ],
   "systemId": "systemId"
}

Create a new User using person UUID

POST /user
{
    "username": "demoUser",
    "password": "Password123",
    "person": "90f7f0b4-06a8-4a97-9678-e7a977f4b518",
    "systemId": "systemId",
    "roles": [
        "774b2af3-6437-4e5a-a310-547554c7c65c"
    ]
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"username\": \"demoUser\",\r\n    \"password\": \"Password123\",\r\n    \"person\": {\r\n        \"names\": [\r\n            {\r\n                \"givenName\": \"Demo\",\r\n                \"familyName\": \"User\"\r\n            }\r\n        ],\r\n        \"gender\": \"M\",\r\n        \"birthdate\": \"1997-09-02\",\r\n        \"addresses\": [\r\n            {\r\n                \"address1\": \"30, Vivekananda Layout, Munnekolal,Marathahalli\",\r\n                \"cityVillage\": \"Bengaluru\",\r\n                \"country\": \"India\",\r\n                \"postalCode\": \"560037\"\r\n            }\r\n        ]\r\n    },\r\n    \"roles\": [\r\n        {\r\n            \"name\": \"Configures Forms\",\r\n            \"description\": \"Manages forms and attaches them to the UI\"\r\n        }\r\n    ],\r\n   \"systemId\": \"systemId\"\r\n}\r\n\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/user")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();

var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"username":"demoUser","password":"Password123","person":{"names":[{"givenName":"Demo","familyName":"User"}],"gender":"M","birthdate":"1997-09-02","addresses":[{"address1":"30, Vivekananda Layout, Munnekolal,Marathahalli","cityVillage":"Bengaluru","country":"India","postalCode":"560037"}]},"roles":[{"name":"Configures Forms","description":"Manages forms and attaches them to the UI"}],"systemId":"systemId"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/user", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the user
description String Description of the user
username String username of the user
password String password of the user
person String person resource associated with the user
systemId String a unique identifier assigned to each user
roles Array[] : role a list of roles attributed to the user
userProperties JSON Object A set of key value pairs. Used to store user specific data
secretQuestion String A secret question chosen by the user

Update a user

Update a user using its UUID

POST /user/:target_user_uuid
{
    "username": "demoUserUpdated"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"username\": \"demoUserUpdated\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/user/0f25e7bc-0d76-4889-8fbf-70ad7d7802a9")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"username":"demoUserUpdated"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/user/0f25e7bc-0d76-4889-8fbf-70ad7d7802a9", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the user
description String Description of the user
username String username of the user
password String password of the user
person String person resource associated with the user
systemId String a unique identifier assigned to each user
roles Array[] : role a list of roles attributed to the user
userProperties JSON Object A set of key value pairs. Used to store user specific data
secretQuestion String A secret question chosen by the user

Delete a user

Delete a user using its UUID

DELETE /user/:target_user_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/user/b953d87d-7e67-47b9-ad1e-fa8b7cdaea4d?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=154692F02BBBC664825F3C4C224A474B")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/user/b953d87d-7e67-47b9-ad1e-fa8b7cdaea4d?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided unless purge = ‘true’

Role

Role Overview

A Role represents a group of privileges in the system. Roles may inherit privileges from other roles, and users may have one or more roles.

Available operations for Role.

  1. List roles
  2. Create a role
  3. Update a role
  4. Delete a role

List roles

List roles

GET /role?v=default&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role?limit=1&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role?limit=1&v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "774b2af3-6437-4e5a-a310-547554c7c65c",
            "display": "Anonymous",
            "name": "Anonymous",
            "description": "Privileges for non-authenticated users.",
            "retired": false,
            "privileges": [],
            "inheritedRoles": [],
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/role/774b2af3-6437-4e5a-a310-547554c7c65c"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/role/774b2af3-6437-4e5a-a310-547554c7c65c?v=full"
                }
            ],
            "resourceVersion": "1.8"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/role?limit=1&v=default&startIndex=1"
        }
    ]
}

Get a role by UUID.

Get a role by UUID

GET /role/:target_role_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role/774b2af3-6437-4e5a-a310-547554c7c65c")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role/774b2af3-6437-4e5a-a310-547554c7c65c", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

*Retrieve a role by its UUID. Returns a 404 Not Found status if the role does not exist. If the user is not logged in to perform this action, a 401 Unauthorized status is returned.

Create a role

Create a role

POST /role
{
    "name": "Clinician",
    "description": "A provider assisting the Lead Surgeon.",
    "privileges": [
        {
            "name": "Delete Patients",
            "description": "Able to delete patients"
        }
    ],
    "inheritedRoles": [
        "774b2af3-6437-4e5a-a310-547554c7c65c"
    ]
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Clinician\",\r\n    \"description\": \"A provider assisting the Lead Surgeon.\",\r\n    \"privileges\": [\r\n        {\r\n            \"name\": \"Delete Patients\",\r\n            \"description\": \"Able to delete patients\"\r\n        }\r\n    ],\r\n    \"inheritedRoles\": [\r\n        \"774b2af3-6437-4e5a-a310-547554c7c65c\"\r\n    ]\r\n}");
Request request = new Request.Builder()
  .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var raw = JSON.stringify({"name":"Clinician","description":"A provider assisting the Lead Surgeon.","privileges":[{"name":"Delete Patients","description":"Able to delete patients"}],"inheritedRoles":["774b2af3-6437-4e5a-a310-547554c7c65c"]});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the role (Required)
description String Description of the role (Required)
privileges Array[] : privileges An array of the privilege resource
inheritedRoles Array[] : inheritedRoles An array of the inheritedRoles type or UUIDs

Update a role

POST /role/:target_role_uuid
{
  "description": "Manages forms and attaches them to the UI"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"description\": \"Manages forms and attaches them to the UI\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role/86f043da-1019-4caf-8db6-d5a472334f58")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var raw = JSON.stringify({"description":"Manages forms and attaches them to the UI"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role/86f043da-1019-4caf-8db6-d5a472334f58", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))


Attributes

Parameter Type Description
name String Name of the role (Required)
description String Description of the role (Required)
privileges Array[] : privileges An array of the privilege resource
inheritedRoles Array[] : inheritedRoles An array of the inheritedRoles type or UUIDs

Delete a role

Delete a role

DELETE /role/:target_role_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role/86f043da-1019-4caf-8db6-d5a472334f58?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role/86f043da-1019-4caf-8db6-d5a472334f58?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Privilege

Overview

A Privilege is an authorization to perform a particular action in the system. The list of available privileges are defined by the core system and by add-on modules (for example, Delete Patients and Manage Encounter Types), but you need to configure which roles have which privileges while you are configuring your system.

Available operations.

  1. List privilege
  2. Create a privilege
  3. Update a privilege
  4. Delete a privilege

List privilege

List privilege

    GET /privilege?v=full&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/privilege?v=full&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/privilege?v=full&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
         {
            "uuid": "24635eec-dd5a-11e6-9d9c-0242ac150002",
            "display": "Add Concept Proposals",
            "name": "Add Concept Proposals",
            "description": "Able to add concept proposals to the system",
            "retired": false,
            "auditInfo": {
                "creator": null,
                "dateCreated": null,
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri":"http://demo.openmrs.org/openmrs/ws/rest/v1/privilege/24635eec-dd5a-11e6-9d9c-0242ac150002"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

Get privilege by UUID

Get privilege by UUID

    GET /privilege/:target_privilege_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/privilege/fd40ed09-b499-405a-8b98-8154a6465e1a")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/privilege/fd40ed09-b499-405a-8b98-8154a6465e1a", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a privilege

Create a privilege

POST /privilege
{
    "name": "Delete Patients",
    "description": "A privilege or permission to delete patients"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Delete Patients\",\r\n    \"description\": \"A privilege or permission to delete patients\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/privilege")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var raw = JSON.stringify({"name":"Delete Patients","description":"A privilege or permission to delete patients"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/privilege", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a privilege

Update a privilege

POST /privilege/:target_privilege_uuid
{
    "description": "A user who can delete all the encounter types"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"description\": \"A user who can delete all the encounter types\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/privilege/246364a0-dd5a-11e6-9d9c-0242ac150002")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var raw = JSON.stringify({"description":"A user who can delete all the encounter types"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/privilege/246364a0-dd5a-11e6-9d9c-0242ac150002", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete a privilege

Delete a privilege

   DELETE /privilege/:target_privilege_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/privilege/24636447-dd5a-11e6-9d9c-0242ac150002?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/privilege/24636447-dd5a-11e6-9d9c-0242ac150002?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Person

Person Overview

Every individual who is referred to in a patient record in OpenMRS is stored in the system as a Person. These include Patients, any patient relative or caretaker, Providers, and Users.

All Persons have these characteristics.

Subresource types

Names

Addresses

Person Attributes

Available Operations for Person type

  1. Search Persons
  2. Create Persons
  3. Update Persons
  4. Delete Persons
  5. List person name
  6. Create person name
  7. Update person name
  8. Delete person name
  9. List person addresses
  10. Create person address
  11. Update person address
  12. Delete person address
  13. List person attributes
  14. Create person attribute
  15. Update person attribute
  16. Delete person attribute

Search Persons

Search Persons

GET /person?q=all&limit=1&v=default

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person?q=all&limit=1&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person?q=all&limit=1&v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "e739808f-f166-42ae-aaf3-8b3e8fa13fda",
            "display": "Christopher Allen",
            "gender": "M",
            "age": 62,
            "birthdate": "1958-05-17T00:00:00.000+0000",
            "birthdateEstimated": false,
            "dead": false,
            "deathDate": null,
            "causeOfDeath": null,
            "preferredName": {
                "uuid": "8fbf3a24-43e9-4e6c-a56c-798e85760493",
                "display": "Christopher Allen",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda/name/8fbf3a24-43e9-4e6c-a56c-798e85760493",
                        "resourceAlias": "name"
                    }
                ]
            },
            "preferredAddress": {
                "uuid": "a0897bec-f008-4f45-b531-2544aaebd71d",
                "display": "Address12463",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda/address/a0897bec-f008-4f45-b531-2544aaebd71d",
                        "resourceAlias": "address"
                    }
                ]
            },
            "attributes": [],
            "voided": false,
            "birthtime": null,
            "deathdateEstimated": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda",
                    "resourceAlias": "person"
                },
                {
                    "rel": "full",
                    "uri": "/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda?v=full",
                    "resourceAlias": "person"
                }
            ],
            "resourceVersion": "1.11"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/person?q=all&limit=1&v=default&startIndex=1",
            "resourceAlias": null
        }
    ]
}

Parameters

Parameter Type Description
q string search by name or for listing all the persons q=all

List person by UUID

List person by UUID

GET /person/:target_person_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a person

Create a person

POST /person
{
    "names": [
        {
        "givenName": "Mohit",
        "familyName": "Kumar"
        }
    ],
    "gender": "M",
    "birthdate": "1997-09-02",
    "addresses": [
        {
        "address1": "30, Vivekananda Layout, Munnekolal,Marathahalli",
        "cityVillage": "Bengaluru",
        "country": "India",
        "postalCode": "560037"
        }
    ]
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"names\": [\r\n        {\r\n        \"givenName\": \"Mohit\",\r\n        \"familyName\": \"Kumar\"\r\n        }\r\n    ],\r\n    \"gender\": \"M\",\r\n    \"birthdate\": \"1997-09-02\",\r\n    \"addresses\": [\r\n        {\r\n        \"address1\": \"30, Vivekananda Layout, Munnekolal,Marathahalli\",\r\n        \"cityVillage\": \"Bengaluru\",\r\n        \"country\": \"India\",\r\n        \"postalCode\": \"560037\"\r\n        }\r\n    ]\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"names":[{"givenName":"Mohit","familyName":"Kumar"}],"gender":"M","birthdate":"1997-09-02","addresses":[{"address1":"30, Vivekananda Layout, Munnekolal,Marathahalli","cityVillage":"Bengaluru","country":"India","postalCode":"560037"}]});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
names Array[] : names List of names
gender String The patient's gender ("M" for male, "F" for female, or "U" for unknown)
age Integer The estimated age in years. Used when birthdate is unknown.
birthDate String Date of birth of a person
birthDateEstimated Boolean True if the birthdate is estimated; false if birthdate is accurate.
birthTime String The time of birth of the person
dead Boolean True if the patient is dead.
deathDate String Date of death of the person
causeOfDeath Concept UUID Reason for the death of the person
deathdateEstimated Boolean true if deathDate is estimate; false if deathDate is accurate
addresses Array[] : addresses The address details aggregated in an array
attributes Array[] : attributes The attribute details aggregated in an array

Update a person

Update a person

POST /person/:target_person_uuid
{
    "gender": "M",
    "birthdate": "1997-01-13",
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"gender\": \"M\",\r\n    \"birthdate\": \"1997-01-13\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"gender":"M","birthdate":"1997-01-13"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete a person

Delete a person

DELETE /person/:target_person_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/e739808f-f166-42ae-aaf3-8b3e8fa13fda?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List person name subresource

List person name subresource

GET /person/:target_person_uuid/name

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "display": "John Taylor",
            "uuid": "4b68f067-6f4d-451a-bd80-342fc21ea486",
            "givenName": "John",
            "middleName": null,
            "familyName": "Taylor",
            "familyName2": null,
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/4b68f067-6f4d-451a-bd80-342fc21ea486",
                    "resourceAlias": "name"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/4b68f067-6f4d-451a-bd80-342fc21ea486?v=full",
                    "resourceAlias": "name"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

List person name subresource by UUID

List person name subresource by UUID

GET /person/:target_person_uuid/name/:target_name_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/4b68f067-6f4d-451a-bd80-342fc21ea486")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/4b68f067-6f4d-451a-bd80-342fc21ea486", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create person name subresource

Create person name subresource

POST person/:target_person_uuid/name
{ 
    "givenName": "Mohit",
    "familyName": "Kumar",
    "preferred": true,
    "prefix": "Mr."
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"givenName\": \"Mohit\",\r\n    \"familyName\": \"Kumar\",\r\n    \"preferred\": true,\r\n    \"prefix\": \"Mr.\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"givenName":"Mohit","familyName":"Kumar","preferred":true,"prefix":"Mr."});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update person name subresource

Update person name subresource

POST person/:target_person_uuid/name/:target_name_uuid
{ 
    "givenName": "Mohit",
    "familyName": "Verma",
    "preferred": true,
    "prefix": "Dr."
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"givenName\": \"Mohit\",\r\n    \"familyName\": \"Verma\",\r\n    \"preferred\": true,\r\n    \"prefix\": \"Dr.\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/4e5c5c75-323e-43f4-afad-c5970209d0f9")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"givenName":"Mohit","familyName":"Verma","preferred":true,"prefix":"Dr."});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/4e5c5c75-323e-43f4-afad-c5970209d0f9", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete person name subresource

Delete person name subresource

DELETE /person/:target_person_uuid/person/:target_name_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/4e5c5c75-323e-43f4-afad-c5970209d0f9?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/name/4e5c5c75-323e-43f4-afad-c5970209d0f9?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


List person address subresource

List person address subresource

GET /person/:target_person_uuid/address

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "display": "Address15501",
            "uuid": "e350d53f-0252-4259-8d87-d97a2d58166e",
            "preferred": true,
            "address1": "Address15501",
            "address2": null,
            "cityVillage": "City5501",
            "stateProvince": "State5501",
            "country": "Country5501",
            "postalCode": "55501",
            "countyDistrict": null,
            "startDate": null,
            "endDate": null,
            "latitude": null,
            "longitude": null,
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address/e350d53f-0252-4259-8d87-d97a2d58166e",
                    "resourceAlias": "address"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address/e350d53f-0252-4259-8d87-d97a2d58166e?v=full",
                    "resourceAlias": "address"
                }
            ],
            "resourceVersion": "2.0"
        }
    ]
}

List person address subresource by UUID

List person address subresource by UUID

GET /person/:target_person_uuid/address/:target_address_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address/e350d53f-0252-4259-8d87-d97a2d58166e")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address/e350d53f-0252-4259-8d87-d97a2d58166e", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create person address subresource

Create person address subresource

POST person/:target_person_uuid/address
{ 
    "address1": "30, Vivekananda Layout, Munnekolal,Marathahalli",
    "cityVillage": "Bengaluru",
    "stateProvince": "Karnataka",
    "postalCode": "560037",
    "latitude": "28.65033",
    "longitude": "77.304255"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"address1\": \"30, Vivekananda Layout, Munnekolal,Marathahalli\",\r\n    \"cityVillage\": \"Bengaluru\",\r\n    \"stateProvince\": \"Karnataka\",\r\n    \"postalCode\": \"560037\",\r\n    \"latitude\": \"28.65033\",\r\n    \"longitude\": \"77.304255\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"address1":"30, Vivekananda Layout, Munnekolal,Marathahalli","cityVillage":"Bengaluru","stateProvince":"Karnataka","postalCode":"560037","latitude":"28.65033","longitude":"77.304255"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address", requestOptions)


Update person address subresource

Update person address subresource

POST person/:target_person_uuid/address/:target_address_uuid
{ 
    "address1": "30, Vivekananda Layout, Munnekolal,Marathahalli",
    "cityVillage": "Bengaluru",
    "stateProvince": "Karnataka",
    "postalCode": "560037",
    "latitude": "28.65033",
    "longitude": "77.304255"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"address1\": \"30, Vivekananda Layout, Munnekolal,Marathahalli\",\r\n    \"cityVillage\": \"Bengaluru\",\r\n    \"stateProvince\": \"Karnataka\",\r\n    \"postalCode\": \"560037\",\r\n    \"latitude\": \"28.65033\",\r\n    \"longitude\": \"77.304255\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address/62fc41dd-e120-40c5-8a66-b651b0a5fecc")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"address1":"30, Vivekananda Layout, Munnekolal,Marathahalli","cityVillage":"Bengaluru","stateProvince":"Karnataka","postalCode":"560037","latitude":"28.65033","longitude":"77.304255"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address/62fc41dd-e120-40c5-8a66-b651b0a5fecc", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
preferred Boolean true if this is the person's preferred address. If a person has multiple addresses, only one can be preferred.
address1 String address of the person
address2 String second address of the person
cityVillage String city/village of the person
stateProvince String name of the state of the person
country String country of the person
postalCode String pin code of the person
countyDistrict String county district of the person
address3 String third address of the person
address4 String fourth address of the person
address5 String fifth address of the person
address6 String sixth address of the person
startDate String date when the person began living at this address
endDate String date when the person stopped living at this address
latitude String latitude of the address
longitude String longitude of the address

Delete a person address subresource

Delete a person address subresource

DELETE /person/:target_person_uuid/person/:target_address_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address/62fc41dd-e120-40c5-8a66-b651b0a5fecc")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/address/62fc41dd-e120-40c5-8a66-b651b0a5fecc", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List person attribute subresource

List person attribute subresource

GET /person/:target_person_uuid/attribute

Success Response


{
    "results": [
        {
            "display": "Birthplace = Birthplace",
            "uuid": "2c7a8991-2435-47df-b7a4-83ca5c341dcd",
            "value": "Birthplace",
            "attributeType": {
                "uuid": "8d8718c2-c2cc-11de-8d13-0010c6dffd0f",
                "display": "Birthplace",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/personattributetype/8d8718c2-c2cc-11de-8d13-0010c6dffd0f",
                        "resourceAlias": "personattributetype"
                    }
                ]
            },
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute/2c7a8991-2435-47df-b7a4-83ca5c341dcd",
                    "resourceAlias": "attribute"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute/2c7a8991-2435-47df-b7a4-83ca5c341dcd?v=full",
                    "resourceAlias": "attribute"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List person attribute subresource by UUID

List person attribute subresource by UUID

GET /person/:target_person_uuid/attribute/:target_attribute_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute/2c7a8991-2435-47df-b7a4-83ca5c341dcd")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute/2c7a8991-2435-47df-b7a4-83ca5c341dcd", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create person attribute subresource

Create person attribute subresource

POST person/:target_person_uuid/attribute
{ 
    "attributeType": "8d8718c2-c2cc-11de-8d13-0010c6dffd0f",
    "value": "Birthplace",
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"attributeType\": \"8d8718c2-c2cc-11de-8d13-0010c6dffd0f\",\r\n    \"value\": \"Birthplace\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"attributeType":"8d8718c2-c2cc-11de-8d13-0010c6dffd0f","value":"Birthplace"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute", requestOptions)
  .then(response => response.text())


Attributes

Parameter Type Description
attributeType UUID UUID of the attributeType (Required)
value String value associated with the attribute (Required)

Update person attribute subresource

Update person attribute subresource

POST person/:target_person_uuid/attribute/:target_attribute_uuid
{ 
    "attributeType": "8d8718c2-c2cc-11de-8d13-0010c6dffd0f",
    "value": "Birthplace"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"attributeType\": \"8d8718c2-c2cc-11de-8d13-0010c6dffd0f\",\r\n    \"value\": \"Birthplace\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute/2c7a8991-2435-47df-b7a4-83ca5c341dcd")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"attributeType":"8d8718c2-c2cc-11de-8d13-0010c6dffd0f","value":"Birthplace"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute/2c7a8991-2435-47df-b7a4-83ca5c341dcd", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
attributeType UUID UUID of the attributeType (Required)
value String value associated with the attribute (Required)

Delete person attribute subresource

Delete person attribute subresource

DELETE /person/:target_person_uuid/person/:target_attribute_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute/2c7a8991-2435-47df-b7a4-83ca5c341dcd?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/person/90f7f0b4-06a8-4a97-9678-e7a977f4b518/attribute/2c7a8991-2435-47df-b7a4-83ca5c341dcd?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


Person Attribute Type

Person Attribute Type Overview

Available operations.

  1. List person attribute types
  2. Create a person attribute type
  3. Update a person attribute type
  4. Delete a person attribute type

List all non-retired person attribute types.

List all non-retired person attribute types

GET /personattributetype?q=race&v=default

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/personattributetype?q=race&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/personattributetype?q=race&v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "8d871386-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Race",
            "name": "Race",
            "description": "Group of persons related by common descent or heredity",
            "format": "java.lang.String",
            "foreignKey": 0,
            "sortWeight": 6.0,
            "searchable": false,
            "editPrivilege": null,
            "retired": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/personattributetype/8d871386-c2cc-11de-8d13-0010c6dffd0f"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/personattributetype/8d871386-c2cc-11de-8d13-0010c6dffd0f?v=full"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

Get person attribute type by UUID.

Get person attribute type by UUID

GET /personattributetype/:target_person_attribute_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/personattributetype/8d871386-c2cc-11de-8d13-0010c6dffd0f")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/personattributetype/8d871386-c2cc-11de-8d13-0010c6dffd0f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a person attribute type

Create a person attribute type

POST /personattributetype
{
    "name": "Edit Civil Status",
    "description": "Able to manage the civil status of persons",
    "format": "org.openmrs.Concept",
    "foreignKey": 1054,
    "searchable": false,
    "editPrivilege": "24635eec-dd5a-11e6-9d9c-0242ac150002"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Edit Civil Status\",\r\n    \"description\": \"Able to manage the civil status of persons\",\r\n    \"format\": \"org.openmrs.Concept\",\r\n    \"foreignKey\": 1054,\r\n    \"searchable\": false,\r\n    \"editPrivilege\": \"24635eec-dd5a-11e6-9d9c-0242ac150002\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/personattributetype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=F8F836D691AB75C7845C6B658D0018E2")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=F8F836D691AB75C7845C6B658D0018E2");

var raw = JSON.stringify({"name":"Edit Civil Status","description":"Able to manage the civil status of persons","format":"org.openmrs.Concept","foreignKey":1054,"searchable":false,"editPrivilege":"24635eec-dd5a-11e6-9d9c-0242ac150002"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/personattributetype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a person attribute type

Update a person attribute type

POST /personattributetype
{
    "name": "Manage Civil Status"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Manage Civil Status\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/personattributetype/aa7569c5-f81f-4e63-ab1f-810103f297ba")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=F8F836D691AB75C7845C6B658D0018E2")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=F8F836D691AB75C7845C6B658D0018E2");

var raw = JSON.stringify({"name":"Manage Civil Status"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/personattributetype/aa7569c5-f81f-4e63-ab1f-810103f297ba", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))


Delete a person attribute type

Delete a person attribute type

DELETE /personattributetype/:target_person_attribute_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/personattributetype/8d8718c2-c2cc-11de-8d13-0010c6dffd0f?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/personattributetype/8d8718c2-c2cc-11de-8d13-0010c6dffd0f?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Patients

Patients Overview

Subresource types of Patient

PatientIdentifier (Identifier)

Allergy

1. Allergen

An allergen refers to a substance capable of triggering a response that starts in the immune system and results in an allergic reaction, for eg in drugs Aspirin, Codeine.., in food beef, eggs.. and others like dust and pollen.

2. Severity

Refers to the severity of the allergy e.g. mild , moderate and severe (uuid:=1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)

3. Reactions

Reactions refers to the effects of the allergy on anybody for e.g. headache(uuid:=139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA) or even unknown(uuid:=1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)

Available operations for Patients

  1. List Patients
  2. Create a patient record
  3. Update a patient record
  4. Delete a patient record
  5. List patientIdentifier sub resource
  6. Create patientIdentifier sub resource with properties
  7. Update patientIdentifier sub resource
  8. Delete patientIdentifier sub resource
  9. List allergy sub resource
  10. Create allergy sub resource with properties
  11. Update allergy sub resource
  12. Delete allergy sub resource

Search patients

Search patients

GET /patient?q=Sarah&v=default&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient?q=Sarah&v=default&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient?q=Sarah&v=default&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "b52ec6f9-0e26-424c-a4a1-c64f9d571eb3",
            "display": "1003EY - Sarah Lewis",
            "identifiers": [
                {
                    "uuid": "5c09b5b6-de14-4a28-bb0c-761a82cbdc1b",
                    "display": "OpenMRS ID = 1003EY",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3/identifier/5c09b5b6-de14-4a28-bb0c-761a82cbdc1b"
                        }
                    ]
                }
            ],
            "person": {
                "uuid": "b52ec6f9-0e26-424c-a4a1-c64f9d571eb3",
                "display": "Sarah Lewis",
                "gender": "F",
                "age": 83,
                "birthdate": "1936-12-04T00:00:00.000+0000",
                "birthdateEstimated": false,
                "dead": false,
                "deathDate": null,
                "causeOfDeath": null,
                "preferredName": {
                    "uuid": "b3918971-c099-4cbe-a323-4b31e4edd493",
                    "display": "Sarah Lewis",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3/name/b3918971-c099-4cbe-a323-4b31e4edd493"
                        }
                    ]
                },
                "preferredAddress": {
                    "uuid": "1955ab01-20ac-4dc4-8c11-74578b05e004",
                    "display": "Address14081",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3/address/1955ab01-20ac-4dc4-8c11-74578b05e004"
                        }
                    ]
                },
                "attributes": [],
                "voided": false,
                "birthtime": null,
                "deathdateEstimated": false,
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3"
                    },
                    {
                        "rel": "full",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3?v=full"
                    }
                ],
                "resourceVersion": "1.11"
            },
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3?v=full"
                }
            ],
            "resourceVersion": "1.8"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient?q=Sarah&v=default&limit=1&startIndex=1"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Display Name of patient.
attributesToFindDuplicatesBy String Patient attributes to find duplicates by. Example of attributes: gender,identifier,birthdate,givenName,middleName,familyName. If you want to include voided patients, add includeVoided attribute.

List patient by UUID.

List patient by UUID

GET /patient/:target_patient_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a patient

Create a new patient.

POST /patient
{
   "identifiers":[
      {
         "identifier":"103VWY7",
         "identifierType":"71075074-f02e-4270-89a3-f2dcda436f70",
         "location":"9356400c-a5a2-4532-8f2b-2361b3446eb8",
         "preferred":true
      }
   ],
   "person":{
      "gender":"M",
      "age":47,
      "birthdate":"1970-01-01T00:00:00.000+0100",
      "birthdateEstimated":false,
      "dead":false,
      "deathDate":null,
      "causeOfDeath":null,
      "names":[
         {
            "givenName":"Thomas",
            "familyName":"Smith"
         }
      ],
      "addresses": [
        {
        "address1": "30, Vivekananda Layout, Munnekolal,Marathahalli",
        "cityVillage": "Bengaluru",
        "country": "India",
        "postalCode": "560037"
        }
      ]
    }
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"identifiers\":[ \r\n  {\"identifier\":\"103VWY7\", \r\n \"identifierType\":\"71075074-f02e-4270-89a3-f2dcda436f70\",\r\n \"location\":\"9356400c-a5a2-4532-8f2b-2361b3446eb8\", \r\n \"preferred\":true}\r\n ], \r\n \"person\":{\r\n \"gender\":\"M\", \r\n \"age\":47,\r\n \"birthdate\":\"1970-01-01T00:00:00.000+0100\",\r\n \"birthdateEstimated\":false,\r\n \"dead\":false,\r\n \"deathDate\":null,\r\n \"causeOfDeath\":null,\r\n \"names\":[\r\n {\r\n  \"givenName\":\"Thomas\",\r\n \"familyName\":\"Smith\" \r\n }\r\n ],\r\n \"addresses\":[\r\n {\r\n \"address1\":\"30,VivekanandaLayout,Munnekolal,Marathahalli\",\r\n \"cityVillage\":\"Bengaluru\",\r\n \"country\":\"India\",\r\n \"postalCode\":\"560037\"\r\n }\r\n]\r\n}\r\n }");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var raw = JSON.stringify({"identifiers":[{"identifier":"103VWY7","identifierType":"71075074-f02e-4270-89a3-f2dcda436f70","location":"9356400c-a5a2-4532-8f2b-2361b3446eb8","preferred":true}],"person":{"gender":"M","age":47,"birthdate":"1970-01-01T00:00:00.000+0100","birthdateEstimated":false,"dead":false,"deathDate":null,"causeOfDeath":null,"names":[{"givenName":"Thomas","familyName":"Smith"}] , "addresses": [{"address1": "30, Vivekananda Layout, Munnekolal,Marathahalli","cityVillage": "Bengaluru","country": "India","postalCode": "560037"}]}});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a patient from an existing person.

Create a patient

POST /patient
{
    "person": "b52ec6f9-0e26-424c-a4a1-c64f9d571eb3",
    "identifiers": [
        {
            "identifier": "1003EY",
            "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334",
            "location": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
            "preferred": false
        }
    ]
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"person\": \"b52ec6f9-0e26-424c-a4a1-c64f9d571eb3\",\r\n    \"identifiers\": [\r\n        {\r\n            \"identifier\": \"1003EY\",\r\n            \"identifierType\": \"05a29f94-c0ed-11e2-94be-8c13b969e334\",\r\n            \"location\": \"8d6c993e-c2cc-11de-8d13-0010c6dffd0f\",\r\n            \"preferred\": false\r\n        }\r\n    ]\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var raw = JSON.stringify({"person":"b52ec6f9-0e26-424c-a4a1-c64f9d571eb3","identifiers":[{"identifier":"1003EY","identifierType":"05a29f94-c0ed-11e2-94be-8c13b969e334","location":"8d6c993e-c2cc-11de-8d13-0010c6dffd0f","preferred":false}]});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Properties

Parameter Type Description
person Person_UUID Person resource UUID (Reqired)
identifiers Array[]: patientIdentifiers List of patientIdentifiers (Required)

Update a patient

Update a patient

  1. For instance we just want to add one more identifier

POST /patient/:target_patient_uuid/identifier
{
    "identifier": "1003EY",
    "identifierType": "a5d38e09-efcb-4d91-a526-50ce1ba5011a",
    "location": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
    "preferred": false
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"identifier\": \"1003EY\",\r\n    \"identifierType\": \"a5d38e09-efcb-4d91-a526-50ce1ba5011a\",\r\n    \"location\": \"8d6c993e-c2cc-11de-8d13-0010c6dffd0f\",\r\n    \"preferred\": false\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3/identifier")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var raw = JSON.stringify({"identifier":"1003EY","identifierType":"a5d38e09-efcb-4d91-a526-50ce1ba5011a","location":"8d6c993e-c2cc-11de-8d13-0010c6dffd0f","preferred":false});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3/identifier", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

### Properties

Parameter Type Description
person Person_UUID Person resource UUID
identifiers Array[]: patientIdentifiers List of patientIdentifiers

Delete a patient

Delete a patient

DELETE /patient/:target_patient_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/b52ec6f9-0e26-424c-a4a1-c64f9d571eb3?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List patientIdentifier sub resources

List patientIdentifier sub resources

GET /patient/:target_patient_uuid/identifier

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "display": "OpenMRS ID = 1001W2",
            "uuid": "a122f3ce-4039-4f8c-9d6f-3faf64c7cb69",
            "identifier": "1001W2",
            "identifierType": {
                "uuid": "05a29f94-c0ed-11e2-94be-8c13b969e334",
                "display": "OpenMRS ID",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334",
                        "resourceAlias": "patientidentifiertype"
                    }
                ]
            },
            "location": {
                "uuid": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
                "display": "Unknown Location",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/location/8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
                        "resourceAlias": "location"
                    }
                ]
            },
            "preferred": true,
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier/a122f3ce-4039-4f8c-9d6f-3faf64c7cb69",
                    "resourceAlias": "identifier"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier/a122f3ce-4039-4f8c-9d6f-3faf64c7cb69?v=full",
                    "resourceAlias": "identifier"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

List patientIdentifier sub resource by it's UUID and parent patient UUID.

List patientIdentifier sub resource by it's UUID

GET /patient/:target_patient_uuid/identifier/:target_identifier_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier/a122f3ce-4039-4f8c-9d6f-3faf64c7cb69")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier/a122f3ce-4039-4f8c-9d6f-3faf64c7cb69", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a patientIdentifier sub resource with properties

Create a patientIdentifier sub resource

POST patient/:target_patient_uuid/identifier
{ 
    "identifier" : "111:CLINIC1",
    "identifierType" : "a5d38e09-efcb-4d91-a526-50ce1ba5011a",
    "location" : "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
    "preferred" : true
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"identifier\" : \"111:CLINIC1\",\r\n    \"identifierType\" : \"a5d38e09-efcb-4d91-a526-50ce1ba5011a\",\r\n    \"location\" : \"8d6c993e-c2cc-11de-8d13-0010c6dffd0f\",\r\n    \"preferred\" : true\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier/")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var raw = JSON.stringify({"identifier":"111:CLINIC1","identifierType":"a5d38e09-efcb-4d91-a526-50ce1ba5011a","location":"8d6c993e-c2cc-11de-8d13-0010c6dffd0f","preferred":true});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Properties

Parameter type Description
identifier String value of the identifier (Required)
identifierType Identifier_Type_UUID Create identifier from this Identifier_type (Required)
location Location UUID Get patients for this location
preferred boolean preferred/not preferred identifier

Update patientIdentifier sub resource with properties

Update patientIdentifier sub resource

POST patient/:target_patient_uuid/identifier/:target_identifier_uuid
{ 
    "identifier" : "111:CLINIC2",
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n    \"identifier\" : \"111:CLINIC2\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier/beb6be1f-07a3-484c-a4ff-92fcb566ddde")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var raw = JSON.stringify({"identifier":"111:CLINIC2"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/e739808f-f166-42ae-aaf3-8b3e8fa13fda/identifier/beb6be1f-07a3-484c-a4ff-92fcb566ddde", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Properties

Parameter Type Description
identifier String updated value of the identifier
identifierType Identifier_Type_UUID Create identifier from this Identifier_type
location Location UUID updated location
preferred boolean updated status of preferred/not preferred identifier

Delete patientIdentifier sub resource with properties

Delete patientIdentifier sub resource

DELETE /patient/:target_patient_uuid/identifier/:target_identifier_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/c7ea5ea9-bec7-4ad0-a803-0ef2dee8fca5/identifier/e5ce3659-9118-4912-8c2f-6d470c2c7940?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/c7ea5ea9-bec7-4ad0-a803-0ef2dee8fca5/identifier/e5ce3659-9118-4912-8c2f-6d470c2c7940?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List allergy subresources

List allergy subresources

GET /patient/:target_patient_uuid/allergy/

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  body: null,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87", requestOptions)
  .then(response => response.text())


Success Response


{
    "results": [
        {
            "display": "ACE inhibitors",
            "uuid": "2d440f27-7a87-4a14-bd21-efb5e99c58dc",
            "allergen": {
                "allergenType": "DRUG",
                "codedAllergen": {
                    "uuid": "162298AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                    "display": "ACE inhibitors",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/concept/162298AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
                        }
                    ]
                },
                "nonCodedAllergen": ""
            },
            "severity": {
                "uuid": "1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "display": "Severe",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/concept/1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
                    }
                ]
            },
            "comment": "take precautions can cause problems",
            "reactions": [
                {
                    "reaction": {
                        "uuid": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                        "display": "Unknown",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/concept/1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
                            }
                        ]
                    },
                    "reactionNonCoded": null
                },
                {
                    "reaction": {
                        "uuid": "139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                        "display": "Headache",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/concept/139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
                            }
                        ]
                    },
                    "reactionNonCoded": null
                },
                {
                    "reaction": {
                        "uuid": "159098AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                        "display": "Hepatotoxicity",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/concept/159098AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
                            }
                        ]
                    },
                    "reactionNonCoded": null
                }
            ],
            "patient": {
                "uuid": "3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87",
                "display": "100J7W - AGB Ake",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87"
                    }
                ]
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/2d440f27-7a87-4a14-bd21-efb5e99c58dc"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/2d440f27-7a87-4a14-bd21-efb5e99c58dc?v=full"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

List allergy subresource by its UUID and parent patient UUID.

List allergy subresource by its UUID and parent patient UUID

GET /patient/:target_patient_uuid/allergy/:target_allergy_uuid

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  body: null,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/2d440f27-7a87-4a14-bd21-efb5e99c58dc", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/2d440f27-7a87-4a14-bd21-efb5e99c58dc")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7")
  .build();
Response response = client.newCall(request).execute();

Create a allergy sub resource with properties

Create a allergy sub resource

POST patient/:target_patient_uuid/allergy
{
    "allergen": {
        "allergenType": "DRUG",
        "codedAllergen": {
            "uuid": "162298AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
        }
    },
    "severity": {
        "uuid": "1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "comment": "severe allergy",
    "reactions": [
        {
            "reaction": {
                "uuid": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
            }
        },
        {
            "reaction": {
                "uuid": "139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
            }
        }
    ]
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"allergen\": {\r\n        \"allergenType\": \"DRUG\",\r\n        \"codedAllergen\": {\r\n            \"uuid\": \"162298AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n        }\r\n    },\r\n    \"severity\": {\r\n        \"uuid\": \"1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n    },\r\n    \"comment\": \"severe allergy\",\r\n    \"reactions\": [\r\n        {\r\n            \"reaction\": {\r\n                \"uuid\": \"1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n            }\r\n        },\r\n        {\r\n            \"reaction\": {\r\n                \"uuid\": \"139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n            }\r\n        }\r\n    ]\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7");

var raw = JSON.stringify({"allergen":{"allergenType":"DRUG","codedAllergen":{"uuid":"162298AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},"severity":{"uuid":"1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"comment":"severe allergy","reactions":[{"reaction":{"uuid":"1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"reaction":{"uuid":"139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}}]});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Properties

Parameter type Description
allergen String value of the allergen (Required)
severity Severity_UUID Severity uuid
comment String comment in reference to the allergy
reaction reaction_UUID reaction uuid

Update allergy sub resource with properties

Update allergy sub resource

POST patient/:target_patient_uuid/allergy/:target_allergy_uuid
{
    "allergen": {
        "allergenType": "DRUG",
        "codedAllergen": {
            "uuid": "162298AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
        }
    },
    "severity": {
        "uuid": "1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
    },
    "comment": "severe allergy",
    "reactions": [
        {
            "reaction": {
                "uuid": "1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
            }
        },
        {
            "reaction": {
                "uuid": "139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
            }
        }
    ]
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"allergen\": {\r\n        \"allergenType\": \"DRUG\",\r\n        \"codedAllergen\": {\r\n            \"uuid\": \"162298AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n        }\r\n    },\r\n    \"severity\": {\r\n        \"uuid\": \"1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n    },\r\n    \"comment\": \"severe allergy\",\r\n    \"reactions\": [\r\n        {\r\n            \"reaction\": {\r\n                \"uuid\": \"1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n            }\r\n        },\r\n        {\r\n            \"reaction\": {\r\n                \"uuid\": \"139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"\r\n            }\r\n        }\r\n    ]\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/ba6e3813-1390-4b4d-9c0e-01de47bb7783")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7");

var raw = JSON.stringify({"allergen":{"allergenType":"DRUG","codedAllergen":{"uuid":"162298AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},"severity":{"uuid":"1500AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},"comment":"severe allergy","reactions":[{"reaction":{"uuid":"1067AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}},{"reaction":{"uuid":"139084AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}}]});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/ba6e3813-1390-4b4d-9c0e-01de47bb7783", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Properties

Parameter type Description
allergen String value of the allergen
severity Severity_UUID Severity uuid
comment String comment for the allergy
reaction reaction_UUID reaction uuid

Delete allergy sub resource with properties

Delete allergy sub resource

DELETE /patient/:target_patient_uuid/allergy/:target_allergy_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/ba6e3813-1390-4b4d-9c0e-01de47bb7783?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=2375C8D206AB15F32A3FA3FEA5824BC7");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patient/3d808dc6-e9b8-4ade-b3fd-32bb0eb08f87/allergy/ba6e3813-1390-4b4d-9c0e-01de47bb7783?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

PatientIdentifierType

PatientIdentifierType Overview

Administrators define what types of identifiers they will collect. These range from National ID numbers, to driver's license numbers, to per-hospital medical record numbers.

Available operations for PatientIdentifierType

  1. List PatientIdentifierType resources
  2. Create a patientIdentifierType record
  3. Update a patientIdentifierType record
  4. Delete a patientIdentifierType record

List PatientIdentifierType resource

List PatientIdentifierType resource

GET /patientidentifiertype?v=default&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patientidentifiertype?v=default&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patientidentifiertype?v=default&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "05a29f94-c0ed-11e2-94be-8c13b969e334",
            "display": "OpenMRS ID",
            "name": "OpenMRS ID",
            "description": "OpenMRS patient identifier, with check-digit",
            "format": null,
            "formatDescription": null,
            "required": true,
            "validator": "org.openmrs.module.idgen.validator.LuhnMod30IdentifierValidator",
            "locationBehavior": null,
            "uniquenessBehavior": null,
            "retired": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334",
                    "resourceAlias": "patientidentifiertype"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334?v=full",
                    "resourceAlias": "patientidentifiertype"
                }
            ],
            "resourceVersion": "2.0"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patientidentifiertype?limit=1&v=default&startIndex=1",
            "resourceAlias": null
        }
    ]
}

Get patientIdentifierType by UUID.

Get patientIdentifierType by UUID

GET /patientidentifiertype/:target_patientIdentifierType_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a patientIdentifierType

Create a patientIdentifierType

POST /patientidentifiertype
{
    "name": "Wilson Hosp MRN",
    "description": "Wilson Hospital Medical Record Number",
    "format": "\\d{1,10}-\\d",
    "formatDescription": "Up to ten digts followed by a hyphen and another digit",
    "required": false,
    "validator": "org.openmrs.patient.impl.LuhnIdentifierValidator",
    "locationBehavior": "NOT_USED",
    "uniquenessBehavior": null
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Wilson Hosp MRN\",\r\n    \"description\": \"Wilson Hospital Medical Record Number\",\r\n    \"format\": \"\\\\d{1,10}-\\\\d\",\r\n    \"formatDescription\": \"Up to ten digts followed by a hyphen and another digit\",\r\n    \"required\": false,\r\n    \"validator\": \"org.openmrs.patient.impl.LuhnIdentifierValidator\",\r\n    \"locationBehavior\": \"NOT_USED\",\r\n    \"uniquenessBehavior\": null\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patientidentifiertype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();



var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var raw = JSON.stringify({"name":"Wilson Hosp MRN","description":"Wilson Hospital Medical Record Number","format":"\\d{1,10}-\\d","formatDescription":"Up to ten digts followed by a hyphen and another digit","required":false,"validator":"org.openmrs.patient.impl.LuhnIdentifierValidator","locationBehavior":"NOT_USED","uniquenessBehavior":null});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patientidentifiertype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Properties

Parameter Type Description
name string label for the identifier (Required)
description string a small description about the patientIdentifier
format string a regular expression defining what the identifier text should contain
formatDescription string an optional description of the regular expression,(used to explain the requirements of the regular expression in terms a user would understand). For example, a regular expression like \d{4,8} could have a description like "Must be a number between 4 and 8 digits in length."
required boolean a true/false whether every patient must have this type
validator string full class name of an IdentifierValidator (e.g., org.openmrs.patient.impl.LuhnIdentifierValidator)

locationBehavior | "REQUIRED" or "NOT USED" | behavior of the location with respect to the identifier,"REQUIRED" if a location must be associated with the identifier; "NOT_USED" if the identifier does require a location

uniquenessBehavior | string | specify the uniqueness of the behaviour, it can be either Unique, Non Unique or Location.

Update a patientIdentifierType

Update a patientIdentifierType

POST /patientidentifertype/:target_patientidentifiertype_uuid
{
    "format": "\\d{1,10}-",
    "formatDescription": "Up to ten digts followed by a hyphen"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"format\": \"\\\\d{1,10}-\",\r\n    \"formatDescription\": \"Up to ten digts followed by a hyphen\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var raw = JSON.stringify({"format":"\\d{1,10}-","formatDescription":"Up to ten digts followed by a hyphen"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete a patientIdentifierType

Delete a patientIdentifierType

DELETE /patientidentifiertype/:target_patientidentifiertype_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

PatientIdentifierSource

PatientIdentifierSource Overview

Available operations for PatientIdentifierSource

  1. List PatientIdentifierSources
  2. Create a PatientIdentifierSource
  3. Update a PatientIdentifierSource
  4. Delete a PatientIdentifierSource
  5. Export PatientIdentifiers from Source
  6. Reserve PatientIdentifiers in Source
  7. Upload PatientIdentifiers from Source
  8. Upload PatientIdentifiers from Request Body

List PatientIdentifierSources

List PatientIdentifierSource

GET /idgen/identifiersource?v=default
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/identifiersource?v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/identifiersource?v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "691eed12-c0f1-11e2-94be-8c13b969e334",
            "name": "Generator for OpenMRS ID",
            "description": null,
            "baseCharacterSet": "0123456789ACDEFGHJKLMNPRTUVWXY",
            "prefix": null,
            "suffix": null,
            "firstIdentifierBase": "10000",
            "minLength": 6,
            "maxLength": null,
            "identifierType": {
                "uuid": "05a29f94-c0ed-11e2-94be-8c13b969e334",
                "display": "OpenMRS ID",
                "name": "OpenMRS ID",
                "description": "OpenMRS patient identifier, with check-digit",
                "format": null,
                "formatDescription": null,
                "required": true,
                "validator": "org.openmrs.module.idgen.validator.LuhnMod30IdentifierValidator",
                "locationBehavior": null,
                "uniquenessBehavior": null,
                "retired": false,
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334",
                        "resourceAlias": "patientidentifiertype"
                    },
                    {
                        "rel": "full",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334?v=full",
                        "resourceAlias": "patientidentifiertype"
                    }
                ],
                "resourceVersion": "2.0"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/identifiersource/691eed12-c0f1-11e2-94be-8c13b969e334",
                    "resourceAlias": "identifiersource"
                }
            ],
            "type": "sequentialidentifiergenerator",
            "resourceVersion": "1.8"
        }
    ]
}

Returns list of all available PatientIdentifierSources.

Query Parameters

Parameter Type Description
identifierType PatientIdentifierType_UUID Source Identifier Type

List PatientIdentifierSource by UUID

List PatientIdentifierSource by UUID

GET /idgen/identifiersource/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retrieve PatientIdentifierSource by its UUID. Returns a 404 Not Found status if patient does not exist in the system. If the user is not logged in to perform this action, a 401 Unauthorized status is returned.

Create a PatientIdentifierSource

Create a PatientIdentifierSource

There are 3 types of PatientIdentifierSource you can create via REST API:

Create SequentialIdentifierGenerator

Create SequentialIdentifierGenerator

POST /idgen/identifiersource
{
    "sourceType": "SequentialIdentifierGenerator",
    "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334",
    "name": "New identifier",
    "description": "Description",
    "firstIdentifierBase": 10000,
    "baseCharacterSet": "0123456789ACDEFGHJKLMNPRTUVWXY",
    "prefix": "",
    "suffix": "",
    "minLength": 3,
    "maxLength": 10
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"sourceType\": \"SequentialIdentifierGenerator\",\n    \"identifierType\": \"05a29f94-c0ed-11e2-94be-8c13b969e334\",\n    \"name\": \"New identifier\",\n    \"description\": \"Description\",\n    \"firstIdentifierBase\": 10000,\n    \"baseCharacterSet\": \"0123456789ACDEFGHJKLMNPRTUVWXY\",\n    \"prefix\": \"\",\n    \"suffix\": \"\",\n    \"minLength\": 3,\n    \"maxLength\": 10\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/identifiersource")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var raw = JSON.stringify({"sourceType": "SequentialIdentifierGenerator","identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334","name": "New identifier","description": "Description","firstIdentifierBase": 10000,"baseCharacterSet": "0123456789ACDEFGHJKLMNPRTUVWXY","prefix": "","suffix": "","minLength": 3,"maxLength": 10});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/identifiersource", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To create a SequentialIdentifierGenerator you need to specify the below properties. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
sourceType String Always set to "SequentialIdentifierGenerator" (Required)
identifierType PatientIdentifierType_UUID Source Identifier Type (Required)
name String Name (Required)
baseCharacterSet String Character set for generating identifiers (Required)
firstIdentifierBase integer Base of first generated identifier (Required)
description String Description
prefix String Identifier Prefix
suffix String Identifier Suffix
minLength integer Minimum Identifier length
maxLength integer Maximum Identifier length

Create RemoteIdentifierSource

Create RemoteIdentifierSource

POST /idgen/identifiersource                                                                                                                                                                                                                                                                                                                                                                                                                                                                
{
    "sourceType": "RemoteIdentifierSource",
    "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334",
    "name": "RemoteIdentifierSource",
    "description": "RemoteIdentifierSource",
    "url": "http://example.com",
    "username": "",
    "password": ""
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
OkHttpClient client = new OkHttpClient().newBuilder()                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
MediaType mediaType = MediaType.parse("application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
RequestBody body = RequestBody.create(mediaType, "{\n    \"sourceType\": \"RemoteIdentifierSource\",\n    \"identifierType\": \"05a29f94-c0ed-11e2-94be-8c13b969e334\",\n    \"name\": \"RemoteIdentifierSource\",\n    \"description\": \"RemoteIdentifierSource\",\n    \"url\": \"http://example.com\",\n    \"username\": \"\",\n    \"password\": \"\"\n}");                              
Request request = new Request.Builder()                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .url("/openmrs/ws/rest/v1/idgen/identifiersource")                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .method("POST", body)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")                                                                                                                                                                                                                                                                                                                                                                                                                                 
  .addHeader("Content-Type", "application/json")                                                                                                                                                                                                                                                                                                                                                                                                                                            
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Response response = client.newCall(request).execute();                                                                                                                                                                                                                                                                                                                                                                                                                                      
var requestHeaders = new Headers();                                                                                                                                                                                                                                                                                                                                                                                                                                                         
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");                                                                                                                                                                                                                                                                                                                                                                                                                       
requestHeaders.append("Content-Type", "application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");                                                                                                                                                                                                                                                                                                                                                                                                             

var raw = JSON.stringify({"sourceType": "RemoteIdentifierSource", "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334","name": "RemoteIdentifierSource","description": "RemoteIdentifierSource","url": "http://example.com","username": "","password": ""});                                                                                                                                                        

var requestOptions = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  method: 'POST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  headers: requestHeaders,                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  body: raw,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  redirect: 'follow'                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
};                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

fetch("/openmrs/ws/rest/v1/idgen/identifiersource", requestOptions)                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(response => response.text())                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(result => console.log(result))                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  .catch(error => console.log('error', error));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

To create a RemoteIdentifierSource you need to specify the below properties. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
sourceType String Always set to "RemoteIdentifierSource" (Required)
identifierType PatientIdentifierType_UUID Source Identifier Type (Required)
name String Name (Required)
url URL Remote Source URL (Required)
description String Description
username String Remote Source Username
password String Remote Source Password

Create IdentifierPool

Create IdentifierPool

POST /idgen/identifiersource                                                                                                                                                                                                                                                                                                                                                                                                                                                                
{
    "sourceType": "IdentifierPool",
    "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334",
    "name": "IdentifierPool",
    "description": "IdentifierPool",
    "batchSize": 1000,
    "minPoolSize": 500,
    "sequential": true,
    "refillWithScheduledTask": false,
    "sourceUuid": ""
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
OkHttpClient client = new OkHttpClient().newBuilder()                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
MediaType mediaType = MediaType.parse("application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
RequestBody body = RequestBody.create(mediaType, "{\n    \"sourceType\": \"IdentifierPool\",\n    \"identifierType\": \"05a29f94-c0ed-11e2-94be-8c13b969e334\",\n    \"name\": \"IdentifierPool\",\n    \"description\": \"IdentifierPool\",\n    \"batchSize\": 1000,\n    \"minPoolSize\": 500,\n    \"sequential\": true,\n    \"refillWithScheduledTask\": false,\n    \"sourceUuid\": \"\"\n}");                              
Request request = new Request.Builder()                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .url("/openmrs/ws/rest/v1/idgen/identifiersource")                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .method("POST", body)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")                                                                                                                                                                                                                                                                                                                                                                                                                                 
  .addHeader("Content-Type", "application/json")                                                                                                                                                                                                                                                                                                                                                                                                                                            
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Response response = client.newCall(request).execute();                                                                                                                                                                                                                                                                                                                                                                                                                                      
var requestHeaders = new Headers();                                                                                                                                                                                                                                                                                                                                                                                                                                                         
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");                                                                                                                                                                                                                                                                                                                                                                                                                       
requestHeaders.append("Content-Type", "application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");                                                                                                                                                                                                                                                                                                                                                                                                             

var raw = JSON.stringify({"sourceType": "IdentifierPool","identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334","name": "IdentifierPool","description": "IdentifierPool","batchSize": 1000,"minPoolSize": 500,"sequential": true,"refillWithScheduledTask": false,"sourceUuid": ""});                                                                                                                                                        

var requestOptions = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  method: 'POST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  headers: requestHeaders,                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  body: raw,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  redirect: 'follow'                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
};                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

fetch("/openmrs/ws/rest/v1/idgen/identifiersource", requestOptions)                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(response => response.text())                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(result => console.log(result))                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  .catch(error => console.log('error', error));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

To create an IdentifierPool you need to specify the below properties. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
sourceType String Always set to "IdentifierPool" (Required)
identifierType PatientIdentifierType_UUID Source Identifier Type (Required)
name String Name (Required)
description String Description
batchSize integer Batch Size
minPoolSize integer Minimum Pool Size
sequential String If true order is Sequential, if false order is Random
refillWithScheduledTask String If true pool is filled as a background task, if false, when you request an identifier
sourceUuid PatientIdentifierSource_UUID UUID of another source that you want to fill this pool from

Update a PatientIdentifierSource

Update a PatientIdentifierSource

There are 3 types of PatientIdentifierSource you can update via REST API:

Update SequentialIdentifierGenerator

Update SequentialIdentifierGenerator

POST /idgen/identifiersource/:uuid
{
    "name": "New identifier",
    "description": "Description",
    "firstIdentifierBase": 10000,
    "baseCharacterSet": "0123456789ACDEFGHJKLMNPRTUVWXY",
    "prefix": "",
    "suffix": "",
    "minLength": 3,
    "maxLength": 10
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\": \"New identifier\",\"description\": \"Description\",\"firstIdentifierBase\": 10000,\"baseCharacterSet\": \"0123456789ACDEFGHJKLMNPRTUVWXY\",\"prefix\": \"\",\"suffix\": \"\",\"minLength\": 3,\"maxLength\": 10}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var raw = JSON.stringify({"name": "New identifier","description": "Description","firstIdentifierBase": 10000,"baseCharacterSet": "0123456789ACDEFGHJKLMNPRTUVWXY","prefix": "","suffix": "","minLength": 3,"maxLength": 10});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To update a SequentialIdentifierGenerator you need to specify the below properties. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
name String Name (Required)
baseCharacterSet String Character set for generating identifiers (Required)
firstIdentifierBase integer Base of first generated identifier (Required)
description String Description
prefix String Identifier Prefix
suffix String Identifier Suffix
minLength integer Minimum Identifier length
maxLength integer Maximum Identifier length

Update RemoteIdentifierSource

Update RemoteIdentifierSource

POST /idgen/identifiersource/:uuid                                                                                                                                                                                                                                                                                                                                                                                                                                                          
{
    "name": "RemoteIdentifierSource",
    "description": "RemoteIdentifierSource",
    "url": "http://example.com",
    "username": "",
    "password": ""
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
OkHttpClient client = new OkHttpClient().newBuilder()                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
MediaType mediaType = MediaType.parse("application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
RequestBody body = RequestBody.create(mediaType, "{\"name\": \"RemoteIdentifierSource\",\"description\": \"RemoteIdentifierSource\",\"url\": \"http://example.com\",\"username\": \"\",\"password\": \"\"} ");                              
Request request = new Request.Builder()                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .url("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid")                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .method("POST", body)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")                                                                                                                                                                                                                                                                                                                                                                                                                                 
  .addHeader("Content-Type", "application/json")                                                                                                                                                                                                                                                                                                                                                                                                                                            
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Response response = client.newCall(request).execute();                                                                                                                                                                                                                                                                                                                                                                                                                                      
var requestHeaders = new Headers();                                                                                                                                                                                                                                                                                                                                                                                                                                                         
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");                                                                                                                                                                                                                                                                                                                                                                                                                       
requestHeaders.append("Content-Type", "application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");                                                                                                                                                                                                                                                                                                                                                                                                             

var raw = JSON.stringify({"name": "RemoteIdentifierSource","description": "RemoteIdentifierSource","url": "http://example.com","username": "","password": ""} );                                                                                                                                                        

var requestOptions = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  method: 'POST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  headers: requestHeaders,                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  body: raw,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  redirect: 'follow'                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
};                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

fetch("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid", requestOptions)                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(response => response.text())                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(result => console.log(result))                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  .catch(error => console.log('error', error));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

To update a RemoteIdentifierSource you need to specify the below properties. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
name String Name (Required)
url URL Remote Source URL (Required)
description String Description
username String Remote Source Username
password String Remote Source Password

Update IdentifierPool

Update IdentifierPool

POST /idgen/identifiersource/:uuid                                                                                                                                                                                                                                                                                                                                                                                                                                                      
{
    "name": "IdentifierPool",
    "description": "IdentifierPool",
    "batchSize": 1000,
    "minPoolSize": 500,
    "sequential": true,
    "refillWithScheduledTask": false,
    "sourceUuid": ""
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
OkHttpClient client = new OkHttpClient().newBuilder()                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
MediaType mediaType = MediaType.parse("application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
RequestBody body = RequestBody.create(mediaType, "{\"name\": \"IdentifierPool\",\"description\": \"IdentifierPool\",\"batchSize\": 1000,\"minPoolSize\": 500,\"sequential\": true,\"refillWithScheduledTask\": false,\"sourceUuid\": \"\"}");                              
Request request = new Request.Builder()                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .url("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid")                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .method("POST", body)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")                                                                                                                                                                                                                                                                                                                                                                                                                                 
  .addHeader("Content-Type", "application/json")                                                                                                                                                                                                                                                                                                                                                                                                                                            
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Response response = client.newCall(request).execute();                                                                                                                                                                                                                                                                                                                                                                                                                                      
var requestHeaders = new Headers();                                                                                                                                                                                                                                                                                                                                                                                                                                                         
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");                                                                                                                                                                                                                                                                                                                                                                                                                       
requestHeaders.append("Content-Type", "application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");                                                                                                                                                                                                                                                                                                                                                                                                             

var raw = JSON.stringify({"name": "IdentifierPool","description": "IdentifierPool","batchSize": 1000,"minPoolSize": 500,"sequential": true,"refillWithScheduledTask": false,"sourceUuid": ""});                                                                                                                                                        

var requestOptions = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  method: 'POST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  headers: requestHeaders,                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  body: raw,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  redirect: 'follow'                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
};                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

fetch("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid", requestOptions)                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(response => response.text())                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(result => console.log(result))                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  .catch(error => console.log('error', error));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

To update an IdentifierPool you need to specify the below properties. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
name String Name (Required)
description String Description
batchSize integer Batch Size
minPoolSize integer Minimum Pool Size
sequential String If true order is Sequential, if false order is Random
refillWithScheduledTask String If true pool is filled as a background task, if false, when you request an identifier
sourceUuid PatientIdentifierSource_UUID UUID of another source that you want to fill this pool from

Delete a PatientIdentifierSource

Delete a PatientIdentifierSource

DELETE /idgen/identifiersource/:uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Deletes or retires a target PatientIdentifierSource by its UUID. Returns a 404 Not Found status if patient not exists. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

Query Parameters

Parameter Type Description
uuid String UUID of PatientIdentifierSource to delete
purge Boolean The resource will be retired unless purge = 'true'

Export PatientIdentifiers from Source

Export PatientIdentifiers from Source

POST /idgen/identifiersource
{
    "generateIdentifiers": true,
    "sourceUuid": "691eed12-c0f1-11e2-94be-8c13b969e334",
    "numberToGenerate": 10
}
OkHttpClient client = new OkHttpClient().newBuilder()                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
MediaType mediaType = MediaType.parse("application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
RequestBody body = RequestBody.create(mediaType, "{\n    \"generateIdentifiers\": true,\n    \"sourceUuid\": \"691eed12-c0f1-11e2-94be-8c13b969e334\",\n    \"numberToGenerate\": 10\n}");                              
Request request = new Request.Builder()                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .url("/openmrs/ws/rest/v1/idgen/identifiersource")                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .method("POST", body)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")                                                                                                                                                                                                                                                                                                                                                                                                                                 
  .addHeader("Content-Type", "application/json")                                                                                                                                                                                                                                                                                                                                                                                                                                            
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Response response = client.newCall(request).execute();                                                                                                                                                                                                                                                                                                                                                                                                                                      
var requestHeaders = new Headers();                                                                                                                                                                                                                                                                                                                                                                                                                                                         
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");                                                                                                                                                                                                                                                                                                                                                                                                                       
requestHeaders.append("Content-Type", "application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");                                                                                                                                                                                                                                                                                                                                                                                                             

var raw = JSON.stringify({"generateIdentifiers": true,"sourceUuid": "691eed12-c0f1-11e2-94be-8c13b969e334","numberToGenerate": 10});                                                                                                                                                        

var requestOptions = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  method: 'POST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  headers: requestHeaders,                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  body: raw,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  redirect: 'follow'                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
};                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

fetch("/openmrs/ws/rest/v1/idgen/identifiersource", requestOptions)                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(response => response.text())                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(result => console.log(result))                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  .catch(error => console.log('error', error));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

Success Response

{
    "identifiers": [
        "1018P3",
        "1018R1",
        "1018TY",
        "1018UW",
        "1018VU",
        "1018WR",
        "1018XN",
        "1018YL",
        "10190J",
        "10191G"
    ]
}

You can export new identifiers from given source in batch by POSTing with properties below:

Properties

Parameter Type Description
generateIdentifiers Boolean Always set to "true" (Required)
sourceUuid PatientIdentifierSource_UUID Source UUID to generate identifiers from
numberToGenerate integer Number of identifiers you want to generate

Reserve PatientIdentifiers in Source

Reserve PatientIdentifiers in Source

POST /idgen/identifiersource/:uuid
{
    "reservedIdentifiers": "10501A,10502A,10503A,10504A,10505A"
}
OkHttpClient client = new OkHttpClient().newBuilder()                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
MediaType mediaType = MediaType.parse("application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
RequestBody body = RequestBody.create(mediaType, "{\"reservedIdentifiers\": \"10501A,10502A,10503A,10504A,10505A\"}");                              
Request request = new Request.Builder()                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .url("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid")                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .method("POST", body)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")                                                                                                                                                                                                                                                                                                                                                                                                                                 
  .addHeader("Content-Type", "application/json")                                                                                                                                                                                                                                                                                                                                                                                                                                            
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Response response = client.newCall(request).execute();                                                                                                                                                                                                                                                                                                                                                                                                                                      
var requestHeaders = new Headers();                                                                                                                                                                                                                                                                                                                                                                                                                                                         
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");                                                                                                                                                                                                                                                                                                                                                                                                                       
requestHeaders.append("Content-Type", "application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");                                                                                                                                                                                                                                                                                                                                                                                                             

var raw = JSON.stringify({"reservedIdentifiers": "10501A,10502A,10503A,10504A,10505A"});                                                                                                                                                        

var requestOptions = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  method: 'POST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  headers: requestHeaders,                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  body: raw,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  redirect: 'follow'                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
};                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

fetch("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid", requestOptions)                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(response => response.text())                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(result => console.log(result))                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  .catch(error => console.log('error', error));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

You can reserve number of provided identifiers by sending POST request with below properties:

Works only with SequentialIdentifierGenerator Source type!

Properties

Parameter Type Description
reservedIdentifiers String Identifiers to be reserved, divided by ","

Upload PatientIdentifiers from Source

Upload PatientIdentifiers from Source

POST /idgen/identifiersource/:uuid
{
    "operation": "uploadFromSource",
    "batchSize": 10
}
OkHttpClient client = new OkHttpClient().newBuilder()                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
MediaType mediaType = MediaType.parse("application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
RequestBody body = RequestBody.create(mediaType, "{\"operation\": \"uploadFromSource\",\"batchSize\": 10}");                              
Request request = new Request.Builder()                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .url("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid")                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .method("POST", body)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")                                                                                                                                                                                                                                                                                                                                                                                                                                 
  .addHeader("Content-Type", "application/json")                                                                                                                                                                                                                                                                                                                                                                                                                                            
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Response response = client.newCall(request).execute();                                                                                                                                                                                                                                                                                                                                                                                                                                      
var requestHeaders = new Headers();                                                                                                                                                                                                                                                                                                                                                                                                                                                         
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");                                                                                                                                                                                                                                                                                                                                                                                                                       
requestHeaders.append("Content-Type", "application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");                                                                                                                                                                                                                                                                                                                                                                                                             

var raw = JSON.stringify({"operation": "uploadFromSource","batchSize": 10});                                                                                                                                                        

var requestOptions = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  method: 'POST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  headers: requestHeaders,                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  body: raw,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  redirect: 'follow'                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
};                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

fetch("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid", requestOptions)                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(response => response.text())                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(result => console.log(result))                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  .catch(error => console.log('error', error));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

You can fill pool of identifiers from another source by sending POST request with below properties:

Works only with IdentifierPool Source type with set "sourceUuid"!

Upload PatientIdentifiers from Request Body

Upload PatientIdentifiers from Request Body

POST /idgen/identifiersource/:uuid
{
    "operation": "uploadFromFile",
    "identifiers": "10501A,10502A,10503A,10504A,10505A"
}
OkHttpClient client = new OkHttpClient().newBuilder()                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
MediaType mediaType = MediaType.parse("application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
RequestBody body = RequestBody.create(mediaType, "{\"operation\": \"uploadFromFile\",\"identifiers\": \"10501A,10502A,10503A,10504A,10505A\"}");                              
Request request = new Request.Builder()                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .url("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid")                                                                                                                                                                                                                                                                                                                                                                                                                                                       
  .method("POST", body)                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")                                                                                                                                                                                                                                                                                                                                                                                                                                 
  .addHeader("Content-Type", "application/json")                                                                                                                                                                                                                                                                                                                                                                                                                                            
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")                                                                                                                                                                                                                                                                                                                                                                                                                       
  .build();                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
Response response = client.newCall(request).execute();                                                                                                                                                                                                                                                                                                                                                                                                                                      
var requestHeaders = new Headers();                                                                                                                                                                                                                                                                                                                                                                                                                                                         
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");                                                                                                                                                                                                                                                                                                                                                                                                                       
requestHeaders.append("Content-Type", "application/json");                                                                                                                                                                                                                                                                                                                                                                                                                                  
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");                                                                                                                                                                                                                                                                                                                                                                                                             

var raw = JSON.stringify({"operation": "uploadFromFile","identifiers": "10501A,10502A,10503A,10504A,10505A"});                                                                                                                                                        

var requestOptions = {                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  method: 'POST',                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  headers: requestHeaders,                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
  body: raw,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
  redirect: 'follow'                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
};                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          

fetch("/openmrs/ws/rest/v1/idgen/identifiersource/:uuid", requestOptions)                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(response => response.text())                                                                                                                                                                                                                                                                                                                                                                                                                                                        
  .then(result => console.log(result))                                                                                                                                                                                                                                                                                                                                                                                                                                                      
  .catch(error => console.log('error', error));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

You can fill pool of identifiers from another source by sending POST request with below properties:

Works only with IdentifierPool Source type!

AutoGenerationOption

AutoGenerationOption Overview

AutoGenerationOption is a Resource which encapsulates the options for Auto-Generating a Patient Identifier.

Available operations for AutoGenerationOption

  1. List AutoGenerationOptions
  2. Create an AutoGenerationOption
  3. Update an AutoGenerationOption
  4. Delete an AutoGenerationOption

List AutoGenerationOptions

List AutoGenerationOptions

GET idgen/autogenerationoption?v=default
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/autogenerationoption?v=default
&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/autogenerationoption?v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "b57bda1d-dbe5-436e-af0f-331be90fee4e",
            "identifierType": {
                "uuid": "05a29f94-c0ed-11e2-94be-8c13b969e334",
                "display": "OpenMRS ID",
                "name": "OpenMRS ID",
                "description": "OpenMRS patient identifier, with check-digit",
                "format": null,
                "formatDescription": null,
                "required": true,
                "validator": "org.openmrs.module.idgen.validator.LuhnMod30IdentifierValidator",
                "locationBehavior": null,
                "uniquenessBehavior": null,
                "retired": false,
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334",
                        "resourceAlias": "patientidentifiertype"
                    },
                    {
                        "rel": "full",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334?v=full",
                        "resourceAlias": "patientidentifiertype"
                    }
                ],
                "resourceVersion": "2.0"
            },
            "location": null,
            "source": {
                "uuid": "691eed12-c0f1-11e2-94be-8c13b969e334",
                "name": "Generator for OpenMRS ID",
                "description": null,
                "baseCharacterSet": "0123456789ACDEFGHJKLMNPRTUVWXY",
                "prefix": null,
                "suffix": null,
                "firstIdentifierBase": "10000",
                "minLength": 6,
                "maxLength": null,
                "identifierType": {
                    "uuid": "05a29f94-c0ed-11e2-94be-8c13b969e334",
                    "display": "OpenMRS ID",
                    "name": "OpenMRS ID",
                    "description": "OpenMRS patient identifier, with check-digit",
                    "format": null,
                    "formatDescription": null,
                    "required": true,
                    "validator": "org.openmrs.module.idgen.validator.LuhnMod30IdentifierValidator",
                    "locationBehavior": null,
                    "uniquenessBehavior": null,
                    "retired": false,
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334",
                            "resourceAlias": "patientidentifiertype"
                        },
                        {
                            "rel": "full",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334?v=full",
                            "resourceAlias": "patientidentifiertype"
                        }
                    ],
                    "resourceVersion": "2.0"
                },
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/identifiersource/691eed12-c0f1-11e2-94be-8c13b969e334",
                        "resourceAlias": "identifiersource"
                    }
                ],
                "type": "sequentialidentifiergenerator",
                "resourceVersion": "1.8"
            },
            "manualEntryEnabled": false,
            "automaticGenerationEnabled": true,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/autogenerationoption/b57bda1d-dbe5-436e-af0f-331be90fee4e",
                    "resourceAlias": "autogenerationoption"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/autogenerationoption/b57bda1d-dbe5-436e-af0f-331be90fee4e?v=full",
                    "resourceAlias": "autogenerationoption"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

Fetches list of AutoGenerationOptions. If not logged in to perform this action, a 401 Unauthorized status is returned.

Get AutoGenerationOption by UUID.

Get AutoGenerationOption by UUID

GET idgen/autogenerationoption/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/autogenerationoption/:uuid
&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/autogenerationoption/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retrieves an AutoGenerationOption by its UUID. Returns a 404 Not Found status if the object does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Create an AutoGenerationOption

Create an AutoGenerationOption

POST idgen/autogenerationoption
{
    "source": "691eed12-c0f1-11e2-94be-8c13b969e334",
    "identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334",
    "manualEntryEnabled": true,
    "automaticGenerationEnabled": true,
    "location": "2131aff8-2e2a-480a-b7ab-4ac53250262b"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"source\": \"691eed12-c0f1-11e2-94be-8c13b969e334\",\"identifierType\": \"05a29f94-c0ed-11e2-94be-8c13b969e334\",\"manualEntryEnabled\": true,\"automaticGenerationEnabled\": true,\"location\": \"2131aff8-2e2a-480a-b7ab-4ac53250262b\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/autogenerationoption")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"source": "691eed12-c0f1-11e2-94be-8c13b969e334","identifierType": "05a29f94-c0ed-11e2-94be-8c13b969e334","manualEntryEnabled": true,"automaticGenerationEnabled": true,"location": "2131aff8-2e2a-480a-b7ab-4ac53250262b"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/autogenerationoption", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

You can create new instance of AutoGenerationOptions by POSTing to the endpoint above with properties below. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
source PatientIdentifierSource_UUID Option's IdentifierSource (Required)
identifierType PatientIdentifierType_UUID Option's IdentifierType (Required)
manualEntryEnabled Boolean Is manual entry enabled for this identifier generator (Required)
automaticGenerationEnabled Boolean Is auto generation enabled for this identifier generator (Required)
location Location_UUID Location where these Options will be applicable (Optional)

Update an AutoGenerationOption

Update an AutoGenerationOption

POST idgen/autogenerationoption/:uuid
{
    "source": "691eed12-c0f1-11e2-94be-8c13b969e334",
    "manualEntryEnabled": true,
    "automaticGenerationEnabled": true,
    "location": "2131aff8-2e2a-480a-b7ab-4ac53250262b"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"source\": \"691eed12-c0f1-11e2-94be-8c13b969e334\",\"manualEntryEnabled\": true,\"automaticGenerationEnabled\": true,\"location\": \"2131aff8-2e2a-480a-b7ab-4ac53250262b\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/autogenerationoption/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"source": "691eed12-c0f1-11e2-94be-8c13b969e334","manualEntryEnabled": true,"automaticGenerationEnabled": true,"location": "2131aff8-2e2a-480a-b7ab-4ac53250262b"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/autogenerationoption/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

You can update existing instance of AutoGenerationOptions by POSTing to the endpoint above with properties below. If object with given UUID doesn't exist, a 404 Not Found status is returned. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
source PatientIdentifierSource_UUID Option's IdentifierSource (Required)
manualEntryEnabled Boolean Is manual entry enabled for this identifier generator (Required)
automaticGenerationEnabled Boolean Is auto generation enabled for this identifier generator (Required)
location Location_UUID Location where these Options will be applicable (Optional)

Delete an AutoGenerationOption

Delete an AutoGenerationOption

DELETE idgen/autogenerationoption/:uuid?purge=true
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/autogenerationoption/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=154692F02BBBC664825F3C4C224A474B")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("openmrs/ws/rest/v1/idgen/autogenerationoption/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete (purge) AutoGenerationOptions by their UUID. Returns a 404 Not Found status if the object does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

This resource cannot be voided/retired.

Patient Identifier LogEntry

LogEntry Overview

LogEntry is a resource that encapsulates Log entry for Patient Identifier generation event.

Available operations for LogEntry

  1. List LogEntries

List LogEntries

List LogEntries

GET idgen/logentry?v=default
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/logentry?v=default)
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/logentry?v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
  "results": [
    {
      "uuid": "10503A",
      "links": [
        {
          "rel": "self",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/logentry/10503A",
          "resourceAlias": "logentry"
        },
        {
          "rel": "full",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/logentry/10503A?v=full",
          "resourceAlias": "logentry"
        }
      ],
      "resourceVersion": "1.8",
      "source": {
        "uuid": "47ea53ab-e57a-4671-b2c8-63a4b31bb140",
        "name": "pool",
        "identifierType": {
          "uuid": "05a29f94-c0ed-11e2-94be-8c13b969e334",
          "display": "OpenMRS ID",
          "name": "OpenMRS ID",
          "description": "OpenMRS patient identifier, with check-digit",
          "format": null,
          "formatDescription": null,
          "required": true,
          "validator": "org.openmrs.module.idgen.validator.LuhnMod30IdentifierValidator",
          "locationBehavior": null,
          "uniquenessBehavior": null,
          "retired": false,
          "links": [
            {
              "rel": "self",
              "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334",
              "resourceAlias": "patientidentifiertype"
            },
            {
              "rel": "full",
              "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334?v=full",
              "resourceAlias": "patientidentifiertype"
            }
          ],
          "resourceVersion": "2.0"
        },
        "display": "OpenMRS ID - pool - org.openmrs.module.idgen.IdentifierPool",
        "links": [
          {
            "rel": "self",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/identifiersource/47ea53ab-e57a-4671-b2c8-63a4b31bb140",
            "resourceAlias": "identifiersource"
          }
        ],
        "type": "identifierpool",
        "resourceVersion": "1.8"
      },
      "identifier": "10503A",
      "comment": "Batch Export of 5 to file",
      "generatedBy": {
        "uuid": "1c3db49d-440a-11e6-a65c-00e04c680037",
        "display": "admin",
        "username": "admin",
        "systemId": "admin",
        "userProperties": {
          "loginAttempts": "0",
          "lockoutTimestamp": "",
          "emrapi.lastViewedPatientIds": "7,8"
        },
        "person": {
          "uuid": "1296b0dc-440a-11e6-a65c-00e04c680037",
          "display": "Super User",
          "links": [
            {
              "rel": "self",
              "uri": "http://localhost:8080/openmrs/ws/rest/v1/person/1296b0dc-440a-11e6-a65c-00e04c680037",
              "resourceAlias": "person"
            }
          ]
        },
        "privileges": [],
        "roles": [
          {
            "uuid": "8d94f852-c2cc-11de-8d13-0010c6dffd0f",
            "display": "System Developer",
            "links": [
              {
                "rel": "self",
                "uri": "http://localhost:8080/openmrs/ws/rest/v1/role/8d94f852-c2cc-11de-8d13-0010c6dffd0f",
                "resourceAlias": "role"
              }
            ]
          },
          {
            "uuid": "8d94f280-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Provider",
            "links": [
              {
                "rel": "self",
                "uri": "http://localhost:8080/openmrs/ws/rest/v1/role/8d94f280-c2cc-11de-8d13-0010c6dffd0f",
                "resourceAlias": "role"
              }
            ]
          }
        ],
        "retired": false,
        "links": [
          {
            "rel": "self",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/user/1c3db49d-440a-11e6-a65c-00e04c680037",
            "resourceAlias": "user"
          },
          {
            "rel": "full",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/user/1c3db49d-440a-11e6-a65c-00e04c680037?v=full",
            "resourceAlias": "user"
          }
        ],
        "resourceVersion": "1.8"
      },
      "dateGenerated": "2021-06-25T21:37:33.000+0200"
    }
  ],
  "links": [
    {
      "rel": "next",
      "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/logentry?v=default&startIndex=50",
      "resourceAlias": null
    }
  ]
}

You can also filter Log Entries with given query parameters. If not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
source PatientIdentifierSource_UUID Filter entries by source
fromDate Date Filter entries older than date
toDate Date Filter entries younger than date
identifier String Filter entries by generated identifier
comment String Filter entries by generation event's comment
generatedBy User_UUID Filter entries by user who executed generation

Get LogEntry by Identifier

Get LogEntry by Identifier

GET idgen/logentry/:identifier
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/idgen/logentry/:identifier)
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/idgen/logentry/:identifier", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

You can also fetch log entry for a unique generated identifier.

Relationship Type

Relationship Type Overview

Relationship Types define the types of relationships between Persons. Also, manage how relationship types are shown to the user (which types are shown by default and in which order).

Relationships have two directions. Some relationships differ depending on the direction; for example, if A is related to B as "Parent", then B is, by definition, related to A as "Child". Other relationships are the same in either direction (e.g., the reverse relationship of "Sibling" is also "Sibling").

Available operations for Relationship Type

  1. List relationship types
  2. Create a relationship type
  3. Update a relationship type
  4. Delete a relationship type

List Relationship Types

Get all non-retired Relationship Types

GET /relationshiptype
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/relationshiptype
&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/relationshiptype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "8d919b58-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Doctor/Patient",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/relationshiptype/8d919b58-c2cc-11de-8d13-0010c6dffd0f",
                    "resourceAlias": "relationshiptype"
                }
            ]
        },
        {
            "uuid": "8d91a01c-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Sibling/Sibling",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/relationshiptype/8d91a01c-c2cc-11de-8d13-0010c6dffd0f",
                    "resourceAlias": "relationshiptype"
                }
            ]
        },
        {
            "uuid": "8d91a210-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Parent/Child",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/relationshiptype/8d91a210-c2cc-11de-8d13-0010c6dffd0f",
                    "resourceAlias": "relationshiptype"
                }
            ]
        },
        {
            "uuid": "8d91a3dc-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Aunt/Uncle/Niece/Nephew",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/relationshiptype/8d91a3dc-c2cc-11de-8d13-0010c6dffd0f",
                    "resourceAlias": "relationshiptype"
                }
            ]
        },
        {
            "uuid": "2a5f4ff4-a179-4b8a-aa4c-40f71956ebbc",
            "display": "Supervisor/Supervisee",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/relationshiptype/2a5f4ff4-a179-4b8a-aa4c-40f71956ebbc",
                    "resourceAlias": "relationshiptype"
                }
            ]
        }
    ]
}

You can filter Relationship Types display with given query parameters. If not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
q Search Query Filter relationship types by name

Get Relationship Type by UUID

Get Relationship Type by UUID

GET /relationshiptype/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/relationshiptype/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/relationshiptype/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retrieve a Relationship Type by its UUID. Returns a 404 Not Found status if the user does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Create a Relationship Type

Create a Relationship Type

{
    "description": "Relationship from a primary care provider to the patient",
    "aIsToB": "Doctor",
    "bIsToA": "Patient",
    "weight": 0
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"description\": \"Relationship from a primary care provider to the patient\",\"aIsToB\": \"Doctor\",\"bIsToA\": \"Patient\",\"weight\": 0}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/relationshiptype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"description": "Relationship from a primary care provider to the patient","aIsToB": "Doctor","bIsToA": "Patient","weight": 0});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/relationshiptype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
aIsToB String How is A related to B
bIsToA String How is B related to A
description String Relationship description
weight integer Relationship weight

Update a Relationship Type

Update a Relationship Type using its UUID

POST /relationshiptype/:uuid
{
    "description": "Relationship between brother/sister, brother/brother, and sister/sister"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"description\": \"Relationship between brother/sister, brother/brother, and sister/sister\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/relationshiptype/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"description":"Relationship between brother/sister, brother/brother, and sister/sister"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/relationshiptype/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a target Relationship Type with given UUID. Returns a 404 Not Found status if the Relationship Type does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
aIsToB String How is A related to B
bIsToA String How is B related to A
description String Relationship description
weight integer Relationship weight

Delete a Relationship Type

Delete a Relationship Type using its UUID

DELETE /relationshiptype/:uuid?purge=true
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/relationshiptype/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=154692F02BBBC664825F3C4C224A474B")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/relationshiptype/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete or retire a Relationship Type by its UUID. Returns a 404 Not Found status if the Relationship Type does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided unless purge = ‘true’

Visits

Visits Overview

At the Amani Clinic, a patient might typically check-in at registration, be seen by a doctor, and receives medication dispensed in the pharmacy. This would be recorded as one visit of visit type of Outpatient and contain three encounters (Registration, Consultation, and Dispensing).

Visits Sub Resource types

Visits Attribute

Available operations for Visits

  1. List visits
  2. Create visit
  3. Update visit
  4. Delete visit
  5. List attribute subresource
  6. Create attribute subresource with properties
  7. Update attribute subresource
  8. Delete attribute subresource

List visits

List visits

GET /visit?includeInactive=true&fromStartDate=2016-10-08T04:09:23.000Z&v=default&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit?includeInactive=true&fromStartDate=2016-10-08T04:09:23.000Z&v=default&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit?includeInactive=true&fromStartDate=2016-10-08T04:09:23.000Z&v=default&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "36475629-6652-44e9-a42b-c2b3b7438f72",
            "display": "Facility Visit @ Unknown Location - 18/01/2017 06:35",
            "patient": {
                "uuid": "c0cbe231-deb8-4cfa-89b4-8fb4570685fc",
                "display": "100DWN - Anthony López",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patient/c0cbe231-deb8-4cfa-89b4-8fb4570685fc",
                        "resourceAlias": "patient"
                    }
                ]
            },
            "visitType": {
                "uuid": "7b0f5697-27e3-40c4-8bae-f4049abfb4ed",
                "display": "Facility Visit",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/visittype/7b0f5697-27e3-40c4-8bae-f4049abfb4ed",
                        "resourceAlias": "visittype"
                    }
                ]
            },
            "indication": null,
            "location": {
                "uuid": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
                "display": "Unknown Location",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/location/8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
                        "resourceAlias": "location"
                    }
                ]
            },
            "startDatetime": "2017-01-18T06:35:03.000+0000",
            "stopDatetime": "2017-01-18T08:20:03.000+0000",
            "encounters": [
                {
                    "uuid": "bc8098b3-2da2-450d-be67-54024dcc5c2c",
                    "display": "Visit Note 18/01/2017",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encounter/bc8098b3-2da2-450d-be67-54024dcc5c2c",
                            "resourceAlias": "encounter"
                        }
                    ]
                },
                {
                    "uuid": "cb35367a-5e98-4be6-9e97-ac575a29b194",
                    "display": "Vitals 18/01/2017",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encounter/cb35367a-5e98-4be6-9e97-ac575a29b194",
                            "resourceAlias": "encounter"
                        }
                    ]
                }
            ],
            "attributes": [],
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/visit/36475629-6652-44e9-a42b-c2b3b7438f72",
                    "resourceAlias": "visit"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/visit/36475629-6652-44e9-a42b-c2b3b7438f72?v=full",
                    "resourceAlias": "visit"
                }
            ],
            "resourceVersion": "1.9"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/visit?includeInactive=true&fromStartDate=2016-10-08T04%3A09%3A23.000Z&v=default&limit=1&startIndex=1",
            "resourceAlias": null
        }
    ]
}

Query Parameters

Parameter Type Description
patient Patient UUID Get visits for this patient
location Location UUID Get visits for this location
includeInactive Boolean Include inactive visits in the results
fromStartDate Date (ISO8601 Long) Include only visits with start date after fromStartDate

List visit by UUID.

List visit by UUID

GET /visit/:target_visit_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit/36475629-6652-44e9-a42b-c2b3b7438f72")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit/36475629-6652-44e9-a42b-c2b3b7438f72", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create visit

Create visit

POST /visit
{
    "patient": "0dfa22b0-6b35-4594-8c3c-7589ad40ed44",
    "visitType": "7b0f5697-27e3-40c4-8bae-f4049abfb4ed",
    "startDatetime": "2016-10-08T04:09:25.000Z",
    "location": "aff27d58-a15c-49a6-9beb-d30dcfc0c66e",
    "indication": null,
    "encounters": [
        "37ecb524-6c5a-4793-a449-cab1be102199"
    ]
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"patient\": \"0dfa22b0-6b35-4594-8c3c-7589ad40ed44\",\r\n    \"visitType\": \"7b0f5697-27e3-40c4-8bae-f4049abfb4ed\",\r\n    \"startDatetime\": \"2016-10-08T04:09:25.000Z\",\r\n    \"location\": \"aff27d58-a15c-49a6-9beb-d30dcfc0c66e\",\r\n    \"indication\": null,\r\n    \"encounters\": [\r\n        \"37ecb524-6c5a-4793-a449-cab1be102199\"\r\n    ]\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"patient":"0dfa22b0-6b35-4594-8c3c-7589ad40ed44","visitType":"7b0f5697-27e3-40c4-8bae-f4049abfb4ed","startDatetime":"2016-10-08T04:09:25.000Z","location":"aff27d58-a15c-49a6-9beb-d30dcfc0c66e","indication":null,"encounters":["37ecb524-6c5a-4793-a449-cab1be102199"]});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
patient Patient UUID Patient resource UUID (Required)
visitType Patient UUID Visit type resource UUID (Required)
startDatetime Date (ISO8601 Long) Start date of the visit
location Location UUID Location resource UUID
indication string Any indication of the visit
stopDatetime Date (ISO8601 Long) End date of the vist
encounters(#encounters) Array[]: Encounter UUID Encounter resources UUID
attributes(#visits-attribute-type) Array[]: Attribute List of visit attributes

Update visit

Update visit

POST /visit/:target_visit_uuid
{
    "startDatetime": "2019-10-08T04:09:25.000Z"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"startDatetime\": \"2019-10-08T04:09:25.000Z\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit/c298d3e1-6def-422a-9d0a-e18906a4ae73")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"startDatetime":"2019-10-08T04:09:25.000Z"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit/c298d3e1-6def-422a-9d0a-e18906a4ae73", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
patient Patient UUID Patient resource UUID
visitType Patient UUID Visit type resource UUID
startDatetime Date (ISO8601 Long) Start date of the visit
location Location UUID Location resource UUID
indication string Any indication of the visit
stopDatetime Date (ISO8601 Long) End date of the vist
encounters(#encounters) Array[]: Encounter UUID Encounter resources UUID
attributes(#visits-attribute-type) Array[]: Attribute List of visit attributes

Delete visit

Delete visit

DELETE /visit/:target_visit_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit/c298d3e1-6def-422a-9d0a-e18906a4ae73?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit/c298d3e1-6def-422a-9d0a-e18906a4ae73?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List attribute subresources

List attribute subresources

GET /visit/:target_visit_uuid/attribute 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "display": "Patient condition: normal condition",
            "uuid": "1162d82e-96b8-4e5b-9cdc-17393fc1044e",
            "attributeType": {
                "uuid": "77fd562e-4e35-4649-b57f-41c3b75882b3",
                "display": "Patient condition",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/visitattributetype/77fd562e-4e35-4649-b57f-41c3b75882b3"
                    }
                ]
            },
            "value": "normal condition",
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute/1162d82e-96b8-4e5b-9cdc-17393fc1044e"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute/1162d82e-96b8-4e5b-9cdc-17393fc1044e?v=full"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

List attribute subresources by it's UUID and parent visit UUID.

List attribute subresources by it's UUID

GET /visit/:target_visit_uuid/attribute/:target_attribute_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute/1162d82e-96b8-4e5b-9cdc-17393fc1044e")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute/1162d82e-96b8-4e5b-9cdc-17393fc1044e", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an attribute subresource

Create an attribute subresource


POST visit/:target_visit_uuid/attribute 
{
    "attributeType": "77fd562e-4e35-4649-b57f-41c3b75882b3",
    "value": "normal condition"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"attributeType\": \"77fd562e-4e35-4649-b57f-41c3b75882b3\",\r\n    \"value\": \"normal condition\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270");

var raw = JSON.stringify({"attributeType":"77fd562e-4e35-4649-b57f-41c3b75882b3","value":"normal condition"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute", requestOptions)
  .then(response => response.text())


Attributes

Parameter Type Description
attributeType Attribute_Type UUID Create Attribute from this Attribute_Type (Required)
value Depends on Attribute_Type Selected Value for the attribute (Required)

Update attribute subresource

Update attribute subresource


POST visit/:target_visit_uuid/attribute/:target_attribute_uuid
{
    "value": "very critical"
} 


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"value\": \"very critical\"\r\n} ");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute/1162d82e-96b8-4e5b-9cdc-17393fc1044e")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270");

var raw = JSON.stringify({"value":"very critical"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute/1162d82e-96b8-4e5b-9cdc-17393fc1044e", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
attributeType Attribute_Type UUID Attribute_Type resource UUID
updated value Depends on Attribute_Type Selected Updated value for the attribute

Delete attribute subresource

Delete attribute subresource

DELETE /visit/:target_visit_uuid/attribute/:target_attribute_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute/1162d82e-96b8-4e5b-9cdc-17393fc1044e?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visit/d29e005a-28d4-4b82-87dd-569ff2a4b8e9/attribute/1162d82e-96b8-4e5b-9cdc-17393fc1044e?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided/retired unless purge = ‘true’

Visits Type

Visits Type Overview

Available operations for Visits Type

  1. List visits types
  2. Create a visit type
  3. Update a visit type
  4. Delete a visit type

list visits types

list visits types

GET /visittype?q=Facility&v=full

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visittype?q=Facility&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visittype?q=Facility&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "7b0f5697-27e3-40c4-8bae-f4049abfb4ed",
            "display": "Facility Visit",
            "name": "Facility Visit",
            "description": "Patient visits the clinic/hospital (as opposed to a home visit, or telephone contact)",
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB",
                    "display": "daemon",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB",
                            "resourceAlias": "user"
                        }
                    ]
                },
                "dateCreated": "2013-08-02T00:39:43.000+0000",
                "changedBy": {
                    "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB",
                    "display": "daemon",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB",
                            "resourceAlias": "user"
                        }
                    ]
                },
                "dateChanged": "2017-01-18T08:53:57.000+0000"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/visittype/7b0f5697-27e3-40c4-8bae-f4049abfb4ed",
                    "resourceAlias": "visittype"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Display Name of Visit Type.

List visit type by UUID.

List visit type by UUID

GET /visittype/:target_visit_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visittype/7b0f5697-27e3-40c4-8bae-f4049abfb4ed")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visittype/7b0f5697-27e3-40c4-8bae-f4049abfb4ed", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a visit type

Create a visit type

POST /visittype
{
    "name": "Facility Visit",
    "description": "Patient visits the clinic/hospital (as opposed to a home visit, or telephone contact)"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Facility Visit\",\r\n    \"description\": \"Patient visits the clinic/hospital (as opposed to a home visit, or telephone contact)\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visittype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"name":"Facility Visit","description":"Patient visits the clinic/hospital (as opposed to a home visit, or telephone contact)"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visittype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a visit type

Update a visit type

POST /type/:target_visit_type_uuid
{
    "name": "Facility Visit",
    "description": "Modified description"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Facility Visit\",\r\n    \"description\": \"Modified description\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visittype/62e364c3-8eb0-46e9-b420-9463a4efdcc9")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"name":"Facility Visit","description":"Modified description"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visittype/62e364c3-8eb0-46e9-b420-9463a4efdcc9", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the visit type
description Patient UUID Visit type resource UUID

Delete a visit type

Delete a visit type

DELETE /visittype/:target_visit_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visittype/62e364c3-8eb0-46e9-b420-9463a4efdcc9?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visittype/62e364c3-8eb0-46e9-b420-9463a4efdcc9?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Visits Attribute Type

Visits Attribute Type Overview

Available operations for Visits Attribute Type

  1. List visits attribute types
  2. Create a visit attribute type
  3. Update a visit attribute type
  4. Delete a visit attribute type

List visits attribute types

List visits attribute types

GET /visitattributetype?q=Patient&v=full 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visitattributetype?q=Patient&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visitattributetype?q=Patient&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "19a9de73-4d0f-48e4-be7b-b35fe0f8586d",
            "display": "Patient condition",
            "name": "Patient condition",
            "description": "This attribute type will record the health conditon of the patient",
            "minOccurs": 0,
            "maxOccurs": 1,
            "datatypeClassname": "org.openmrs.customdatatype.datatype.LongFreeTextDatatype",
            "datatypeConfig": "default",
            "preferredHandlerClassname": "org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler",
            "handlerConfig": null,
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
                    "display": "admin",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
                            "resourceAlias": "user"
                        }
                    ]
                },
                "dateCreated": "2020-10-31T19:25:30.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/visitattributetype/19a9de73-4d0f-48e4-be7b-b35fe0f8586d",
                    "resourceAlias": "visitattributetype"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Display Name of Visit attribute type.

List visit attribute type by UUID

List visit attribute type by UUID

GET /visitattributetype/:target_visit_attribute_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visitattributetype/19a9de73-4d0f-48e4-be7b-b35fe0f8586d")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visitattributetype/19a9de73-4d0f-48e4-be7b-b35fe0f8586d", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a visit attribute type

Create a visit attribute type

POST /visitattributetype
{
  "name": "Patient condition",
  "description": "This attribute type will record the health conditon of the patient",
  "datatypeClassname": "org.openmrs.customdatatype.datatype.FreeTextDatatype",
  "minOccurs": 0,
  "maxOccurs": 1,
  "datatypeConfig": "default"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Patient condition\",\r\n  \"description\": \"This attribute type will record the health conditon of the patient\",\r\n  \"datatypeClassname\": \"org.openmrs.customdatatype.datatype.FreeTextDatatype\",\r\n  \"minOccurs\": 0,\r\n  \"maxOccurs\": 1,\r\n  \"datatypeConfig\": \"default\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("https://demo.openmrs.org/openmrs/ws/rest/v1/visitattributetype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=A7DBC9603F0BAF39988C59B870111270");

var raw = JSON.stringify({"name":"Patient condition","description":"This attribute type will record the health conditon of the patient","datatypeClassname":"org.openmrs.customdatatype.datatype.FreeTextDatatype","minOccurs":0,"maxOccurs":1,"datatypeConfig":"default"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/visitattributetype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a visit attribute type

Update a visit attribute type

POST /visitattributetype/:target_visit_attribute_type_uuid
{
  "name": "Patient condition modified",
  "description": "This attribute type will keep a record the health conditon of the patient",
  "minOccurs": 0,
  "maxOccurs": 2
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Patient condition modified\",\r\n  \"description\": \"This attribute type will keep a record the health conditon of the patient\",\r\n  \"minOccurs\": 0,\r\n  \"maxOccurs\": 2\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visitattributetype/44bacae8-9563-40da-869d-35fcdd652a21")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"name":"Patient condition modified","description":"This attribute type will keep a record the health conditon of the patient","minOccurs":0,"maxOccurs":2});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visitattributetype/44bacae8-9563-40da-869d-35fcdd652a21", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the visit attribute type
description String Description
datatypeClassname CustomDataType Resource Data type for the attribute type resource.OpenMRS provides Custom data type resource which gives flexibility to select the data type accordingly
minOccurs Number Minimum number of times this value can be specified for a single visit. Use 0 or 1 as the default value
maxOccurs Number Maximum number of times this value can be specified for a single visit (e.g., use 1 to prevent an attribute from being added to a visit multiple times)
preferredHandlerClassname Handler Handler subresource for the Custom Data Type used. Can optionally define a specific handler class wants to use (otherwise the framework will choose the best handler for the chosen DataType ).To find which handlers to use for the Custom DataType, please refer here
datatypeConfig String Allow the data type have any name and config it wants/needs.
handlerConfig String Allow the handler have any name and config it wants/needs. This will help to identify the data type unambiguously which has been contained and will allow introspecting

Delete a visit attribute type

Delete a visit attribute type

DELETE /visitattributetype/:target_visit_attribute_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visitattributetype/44bacae8-9563-40da-869d-35fcdd652a21?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visitattributetype/44bacae8-9563-40da-869d-35fcdd652a21?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided/retired unless purge = ‘true’.Purging will attempt to remove the attribute type from the system irreversibly. Attribute types that have been used (i.e., are referenced from existing data) cannot be purged.

Visits Configuration

Visits Configuration Overview

Visits introduce a set of settings related to Visits Behavior. You can retrieve and update this configuration through REST API.

Available operations for Visits Configuration

  1. Retrieve Configuration
  2. Update Configuration

Retrieve Configuration

Retrieve Configuration

GET /visitconfiguration
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visitconfiguration")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visitconfiguration", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "encounterVisitsAssignmentHandler": "org.openmrs.api.handler.NoVisitAssignmentHandler",
    "enableVisits": true,
    "startAutoCloseVisitsTask": true,
    "visitTypesToAutoClose": [
        {
            "uuid": "48d69339-bb3a-489f-bf23-70e3da9cfc4d",
            "display": "Test",
            "name": "Test",
            "description": null,
            "retired": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "/ws/rest/v1/visittype/48d69339-bb3a-489f-bf23-70e3da9cfc4d",
                    "resourceAlias": "visittype"
                },
                {
                    "rel": "full",
                    "uri": "/ws/rest/v1/visittype/48d69339-bb3a-489f-bf23-70e3da9cfc4d?v=full",
                    "resourceAlias": "visittype"
                }
            ]
        }
    ]
}

Retrieves current configuration.

Update Configuration

Update Configuration

POST /visitconfiguration
{
    "enableVisits": true,
    "encounterVisitsAssignmentHandler": "org.openmrs.api.handler.NoVisitAssignmentHandler",
    "startAutoCloseVisitsTask": true,
    "visitTypesToAutoClose": [
        {
            "uuid": "48d69339-bb3a-489f-bf23-70e3da9cfc4d"
        }
    ]
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"enableVisits\": true,\"encounterVisitsAssignmentHandler\":\"org.openmrs.api.handler.NoVisitAssignmentHandler\",\"startAutoCloseVisitsTask\": true,\"visitTypesToAutoClose\": [{\"uuid\": \"48d69339-bb3a-489f-bf23-70e3da9cfc4d\"}]}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/visitconfiguration")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"enableVisits": true,"encounterVisitsAssignmentHandler":"org.openmrs.api.handler.NoVisitAssignmentHandler","startAutoCloseVisitsTask": true,"visitTypesToAutoClose": [{"uuid": "48d69339-bb3a-489f-bf23-70e3da9cfc4d"}]});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/visitconfiguration", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Updates current configuration with the following properties:

Attributes

Parameter Type Description
enableVisits Boolean Are visits enabled
encounterVisitsAssignmentHandler String Class name of EncounterVisitHandler subclass
startAutoCloseVisitsTask Boolean Should visits be automatically closed
visitTypesToAutoClose Array[]: VisitType List of visit types to automatically close. Only UUID field, see an example.

Location

Location Overview

Location Sub Resource types

Location Attribute.

Available operations for location

  1. List location
  2. Create a location
  3. Update a location
  4. Delete a location
  5. List location attribute subresource
  6. Create location attribute subresource with properties
  7. Update location attribute subresource
  8. Delete location attribute subresource

List location

List location

GET /location?q=amani&v=default

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location?q=amani&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location?q=amani&v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "aff27d58-a15c-49a6-9beb-d30dcfc0c66e",
            "display": "Amani Hospital",
            "name": "Amani Hospital",
            "description": null,
            "address1": null,
            "address2": null,
            "cityVillage": null,
            "stateProvince": null,
            "country": null,
            "postalCode": null,
            "latitude": null,
            "longitude": null,
            "countyDistrict": null,
            "tags": [
                {
                    "uuid": "37dd4458-dc9e-4ae6-a1f1-789c1162d37b",
                    "display": "Visit Location",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/locationtag/37dd4458-dc9e-4ae6-a1f1-789c1162d37b"
                        }
                    ]
                }
            ],
            "parentLocation": null,
            "childLocations": [
                {
                    "uuid": "b1a8b05e-3542-4037-bbd3-998ee9c40574",
                    "display": "Inpatient Ward",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/b1a8b05e-3542-4037-bbd3-998ee9c40574"
                        }
                    ]
                },
                {
                    "uuid": "2131aff8-2e2a-480a-b7ab-4ac53250262b",
                    "display": "Isolation Ward",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/2131aff8-2e2a-480a-b7ab-4ac53250262b"
                        }
                    ]
                },
                {
                    "uuid": "7fdfa2cb-bc95-405a-88c6-32b7673c0453",
                    "display": "Laboratory",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/7fdfa2cb-bc95-405a-88c6-32b7673c0453"
                        }
                    ]
                },
                {
                    "uuid": "58c57d25-8d39-41ab-8422-108a0c277d98",
                    "display": "Outpatient Clinic",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/58c57d25-8d39-41ab-8422-108a0c277d98"
                        }
                    ]
                },
                {
                    "uuid": "7f65d926-57d6-4402-ae10-a5b3bcbf7986",
                    "display": "Pharmacy",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/7f65d926-57d6-4402-ae10-a5b3bcbf7986"
                        }
                    ]
                },
                {
                    "uuid": "6351fcf4-e311-4a19-90f9-35667d99a8af",
                    "display": "Registration Desk",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/6351fcf4-e311-4a19-90f9-35667d99a8af"
                        }
                    ]
                }
            ],
            "retired": false,
            "attributes": [],
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e?v=full"
                }
            ],
            "resourceVersion": "2.0"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Display Name of Location object.

List location by UUID.

List location by UUID

GET /location/:target_location_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a location

Create a location

POST /location
{
    "name": "Salzburg Hospital",
    "description": "Salzburg hospital location",
    "address1": "Mullner House 48",
    "cityVillage": "salzburg",
    "stateProvince": "salzburg",
    "country": "Austria",
    "postalCode": "5020",
    "countyDistrict": "salzburg",
    "tags": [
        "37dd4458-dc9e-4ae6-a1f1-789c1162d37b"
    ],
    "childLocations": [
        "7fdfa2cb-bc95-405a-88c6-32b7673c0453",
        "6351fcf4-e311-4a19-90f9-35667d99a8af"
    ],
    "attributes": [
        {
            "attributeType": "fa0527cb-8b37-4a0a-8e7a-cff04acc8554",
            "value": "low humidity"
        }
    ]
}

Attributes

Parameter Type Description
name String Name of the location (Required)
address1 String Address of the location (Required)
description String Description
cityVillage String City/village
stateProvince String State and province
country String Country
postalCode String Postal code of the location
latitude String Latitude
longitude String Longitude
countyDistrict String District or Country
tags Array[]: LocationTag UUID UUID's of the location tags
parentLocation Parent Location UUID UUID of the target parent location
childLocations Array[]: Child Location UUID UUID's of the target child locations e.g.(Inpatient ward, outpatient clinic)
attributes Array[]: Attribute UUID UUID's of location attributes

Update a location

Update a location

POST /location/:target_location_uuid
{
    "description": "Modified location of Salzburg hospital location"
}       

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"description\": \"Modified location of Salzburg hospital location\"\r\n}       \r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var raw = JSON.stringify({"description":"Modified location of Salzburg hospital location"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the location (Required)
address1 String Address of the location (Required)
description String Description
cityVillage String City/village
stateProvince String State and province
country String Country
postalCode String Postal code of the location
latitude String Latitude
longitude String Longitude
countyDistrict String District or Country
tags Array[]: LocationTag UUID UUID's of the location tags
parentLocation Parent Location UUID UUID of the target parent location
childLocations Array[]: Child Location UUID UUID's of the target child locations e.g.(Inpatient ward, outpatient clinic)
attributes Array[]: Attribute UUID UUID's of location attributes

Delete a location

DELETE /location/:target_location_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List location attribute subresources

List location attribute subresources

GET /location/:target_location_uuid/attribute 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "display": "humidity: low humidity",
            "uuid": "83f76320-0fa9-4bd7-b13f-7304ef723e8d",
            "attributeType": {
                "uuid": "fa0527cb-8b37-4a0a-8e7a-cff04acc8554",
                "display": "humidity",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/locationattributetype/fa0527cb-8b37-4a0a-8e7a-cff04acc8554"
                    }
                ]
            },
            "value": "low humidity",
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute/83f76320-0fa9-4bd7-b13f-7304ef723e8d"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute/83f76320-0fa9-4bd7-b13f-7304ef723e8d?v=full"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

List location attribute subresources by own UUID and parent location UUID.

List location attribute subresources by own UUID

GET /location/:target_location_uuid/attribute/:target_attribute_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute/83f76320-0fa9-4bd7-b13f-7304ef723e8d")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute/83f76320-0fa9-4bd7-b13f-7304ef723e8d", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a location attribute subresource with properties

POST location/:target_location_uuid/attribute 
{
    "attributeType": "fa0527cb-8b37-4a0a-8e7a-cff04acc8554",
    "value": "high humidity"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"attributeType\": \"fa0527cb-8b37-4a0a-8e7a-cff04acc8554\",\r\n    \"value\": \"high humidity\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var raw = JSON.stringify({"attributeType":"fa0527cb-8b37-4a0a-8e7a-cff04acc8554","value":"high humidity"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute", requestOptions)
  .then(response => response.text())


Update a location attribute subresource

Update a location attribute subresource

POST location/:target_location_uuid/attribute/:target_location_attribute_uuid
{
    "value": "low humidity"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"value\": \"low humidity\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute/83f76320-0fa9-4bd7-b13f-7304ef723e8d")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var raw = JSON.stringify({"value":"low humidity"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute/83f76320-0fa9-4bd7-b13f-7304ef723e8d", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

### Attributes

Parameter Type Description
attributeType Attribute_Type UUID Create Attribute from this Location Attribute_Type (Required)
value Depends on Attribute_Type Selected Value for the attribute (Required)

Delete a location attribute subresource

Delete a location attribute subresource

DELETE /location/:target_location_uuid/attribute/:target_location_attribute_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute/83f76320-0fa9-4bd7-b13f-7304ef723e8d?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/location/aff27d58-a15c-49a6-9beb-d30dcfc0c66e/attribute/83f76320-0fa9-4bd7-b13f-7304ef723e8d?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Location Tag Type

Location Tag Overview

Available operations for Location Tag

  1. List location tags
  2. Create a location tag
  3. Update a location tag
  4. Delete a location tag

List location tags

List location tags

GET /locationtag?q=visit&v=full

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationtag?q=visit&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationtag?q=visit&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "37dd4458-dc9e-4ae6-a1f1-789c1162d37b",
            "display": "Visit Location",
            "name": "Visit Location",
            "description": "Visits are only allowed to happen at locations tagged with this location tag or at locations that descend from a location tagged with this tag.",
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB",
                    "display": "daemon",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB"
                        }
                    ]
                },
                "dateCreated": "2013-08-01T23:45:29.000+0000",
                "changedBy": {
                    "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB",
                    "display": "daemon",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB"
                        }
                    ]
                },
                "dateChanged": "2017-01-18T08:54:00.000+0000"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/locationtag/37dd4458-dc9e-4ae6-a1f1-789c1162d37b"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

Quickly filter location tags with a given search query. Returns a 404 Not Found status if the location tag not exists. If the user not logged in to perform this action, a 401 Unauthorized status returned.

### Query Parameters

Parameter Type Description
q Search Query Display Name of Location location tag type.

List location tag by UUID.

List location tag by UUID

GET /locationtag/:target_location_tag_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationtag/37dd4458-dc9e-4ae6-a1f1-789c1162d37b")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationtag/37dd4458-dc9e-4ae6-a1f1-789c1162d37b", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a location tag

Create a location tag

POST /locationtag
{
  "name": "Visit Location",
  "description": "Visits are only allowed to happen at locations tagged with this location tag.",
  "retired": false
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Visit Location\",\r\n  \"description\": \"Visits are only allowed to happen at locations tagged with this location tag.\",\r\n  \"retired\": false\r\n  }\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationtag/")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704");

var raw = JSON.stringify({"name":"Visit Location","description":"Visits are only allowed to happen at locations tagged with this location tag.","retired":false});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationtag/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a location tag

Update a location tag

POST /locationtag/:target_location_tag_uuid
{
  "retired": true
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"retired\": true\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationtag/8d4626ca-7abd-42ad-be48-56767bbcf272")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704");

var raw = JSON.stringify({"retired":true});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationtag/8d4626ca-7abd-42ad-be48-56767bbcf272", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the location tag type
description String Description
retired Boolean Retired status of the location tag
retiredReason String For location tags that are retired, this may contain an explanation of why the location tag was retired.

Delete a location tag

Delete a location tag

DELETE /locationtag/:target_location_tag_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationtag/c0b3c7f7-6dec-4c6c-9363-813f755b96e5?purge =true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationtag/c0b3c7f7-6dec-4c6c-9363-813f755b96e5?purge =true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Location Attribute Type

Location Attribute Overview

Available operations for Location Attribute

  1. List location attribute types
  2. Create a location attribute type
  3. Update a location attribute type
  4. Delete a location attribute type

List location attribute types

List location attribute types

GET /locationattributetype?q=humidity

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationattributetype?q=humidity&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationattributetype?q=humidity&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


Success Response


{
    "results": [
        {
            "uuid": "e2844ee5-bfdd-4d07-bfc4-2afaf6bfe60c",
            "display": "humidity",
            "name": "humidity",
            "description": "This attribute type will record the humidity of the location",
            "minOccurs": 0,
            "maxOccurs": 1,
            "datatypeClassname": "org.openmrs.customdatatype.datatype.LongFreeTextDatatype",
            "datatypeConfig": "default",
            "preferredHandlerClassname": "org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler",
            "handlerConfig": null,
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
                    "display": "admin",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002"
                        }
                    ]
                },
                "dateCreated": "2020-11-02T20:08:50.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/locationattributetype/e2844ee5-bfdd-4d07-bfc4-2afaf6bfe60c"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

List location attribute type by UUID.

List location attribute type by UUID

GET /locationattributetype/:target_location_attribute_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationattributetype/fa0527cb-8b37-4a0a-8e7a-cff04acc8554")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationattributetype/fa0527cb-8b37-4a0a-8e7a-cff04acc8554", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a location attribute type

Create a location attribute type

POST /locationattributetype
{
  "name": "humidity",
  "description": "This attribute type will record the humidity of the location",
  "datatypeClassname": "org.openmrs.customdatatype.datatype.FreeTextDatatype",
  "minOccurs": 0,
  "maxOccurs": 1,
  "datatypeConfig": "default"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"humidity\",\r\n  \"description\": \"This attribute type will record the humidity of the location\",\r\n  \"datatypeClassname\": \"org.openmrs.customdatatype.datatype.FreeTextDatatype\",\r\n  \"minOccurs\": 0,\r\n  \"maxOccurs\": 1,\r\n  \"datatypeConfig\": \"default\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationattributetype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var raw = JSON.stringify({"name":"humidity","description":"This attribute type will record the humidity of the location","datatypeClassname":"org.openmrs.customdatatype.datatype.FreeTextDatatype","minOccurs":0,"maxOccurs":1,"datatypeConfig":"default"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationattributetype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a location attribute type

Update a location attribute type

POST /locationattributetype/:target_location_attribute_type_uuid
{
  "minOccurs": 0,
  "maxOccurs": 2
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"minOccurs\": 0,\r\n  \"maxOccurs\": 2\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationattributetype/e2844ee5-bfdd-4d07-bfc4-2afaf6bfe60c")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704");

var raw = JSON.stringify({"minOccurs":0,"maxOccurs":2});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationattributetype/e2844ee5-bfdd-4d07-bfc4-2afaf6bfe60c", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the location attribute type
description String Description
datatypeClassname CustomDataType Resource Data type for the attribute type resource. OpenMRS provides Custom data type resource which gives flexibility to select the data type accordingly (Required)
minOccurs Number Minimum number of times this value can be specified for a single location. Use 0 or 1 as the default value
maxOccurs Number Maximum number of times this value can be specified for a single location (e.g., use 1 to prevent an attribute from being added to a location multiple times)
preferredHandlerClassname Handler Handler subresource for the Custom Data Type used. Can optionally define a specific handler class want to use (otherwise the framework will choose the best handler for the chosen DataType). To find which handlers to use for the Custom DataType, please refer here
datatypeConfig String Allow the data type have any name and config it wants/needs.
handlerConfig String Allow the handler have any name and config it wants/needs. This will help to identify the data type unambiguously which has been contained and will allow introspecting

Delete a location attribute type

Delete a location attribute type

DELETE /locationattributetype/:target_location_attribute_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/locationattributetype/e2844ee5-bfdd-4d07-bfc4-2afaf6bfe60c?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=177F9C2E5ED43272221D31E103D6B704");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/locationattributetype/e2844ee5-bfdd-4d07-bfc4-2afaf6bfe60c?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Encounters

Encounter Overview

Let's look at an example of Encounter

Sub Resource types of Encounter

Encounter Provider

Available operations for Encounter

  1. List encounters
  2. Create an encounter
  3. Update an encounter
  4. Delete an encounter
  5. List encounter provider sub resource
  6. Create encounter provider sub resource with properties
  7. Update encounter provider sub resource
  8. Delete encounter provider sub resource

List encounters

List encounters

GET /encounter?patient=96be32d2-9367-4d1d-a285-79a5e5db12b8&concept=18316c68-b5f9-4986-b76d-9975cd0ebe31&fromdate=2016-10-08&v=default&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter?patient=96be32d2-9367-4d1d-a285-79a5e5db12b8&concept=18316c68-b5f9-4986-b76d-9975cd0ebe31&fromdate=2016-10-08&v=default&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=3EFCD2FD54D00BE8491DFFD43AA706DC")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=3EFCD2FD54D00BE8491DFFD43AA706DC");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter?patient=96be32d2-9367-4d1d-a285-79a5e5db12b8&concept=18316c68-b5f9-4986-b76d-9975cd0ebe31&fromdate=2016-10-08&v=default&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "d3360c01-9813-4ff8-bd81-909af6612632",
            "display": "Vitals 24/02/2015",
            "encounterDatetime": "2015-02-24T06:08:25.000+0000",
            "patient": {
                "uuid": "96be32d2-9367-4d1d-a285-79a5e5db12b8",
                "display": "1000C6 - Elizabeth Johnson",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/patient/96be32d2-9367-4d1d-a285-79a5e5db12b8"
                    }
                ]
            },
            "location": {
                "uuid": "58c57d25-8d39-41ab-8422-108a0c277d98",
                "display": "Outpatient Clinic",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/location/58c57d25-8d39-41ab-8422-108a0c277d98"
                    }
                ]
            },
            "form": {
                "uuid": "a000cb34-9ec1-4344-a1c8-f692232f6edd",
                "display": "Vitals",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/form/a000cb34-9ec1-4344-a1c8-f692232f6edd"
                    }
                ]
            },
            "encounterType": {
                "uuid": "67a71486-1a54-468f-ac3e-7091a9a79584",
                "display": "Vitals",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/encountertype/67a71486-1a54-468f-ac3e-7091a9a79584"
                    }
                ]
            },
            "obs": [
                {
                    "uuid": "22639f6e-b4b8-4c99-8a6a-d1faff59cff6",
                    "display": "Diastolic blood pressure: 36.0",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/obs/22639f6e-b4b8-4c99-8a6a-d1faff59cff6"
                        }
                    ]
                },
                {
                    "uuid": "eb66922c-c0a9-49e4-8648-18d68f9a4499",
                    "display": "Weight (kg): 63.0",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/obs/eb66922c-c0a9-49e4-8648-18d68f9a4499"
                        }
                    ]
                },
                {
                    "uuid": "c29194d7-af8b-449d-a0e5-7ca6ec19ce65",
                    "display": "Height (cm): 93.0",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/obs/c29194d7-af8b-449d-a0e5-7ca6ec19ce65"
                        }
                    ]
                }
            ],
            "orders": [],
            "voided": false,
            "visit": {
                "uuid": "69b3265b-1521-4c27-8d3f-ae99b689e7a9",
                "display": "Facility Visit @ Unknown Location - 24/02/2015 06:00",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/visit/69b3265b-1521-4c27-8d3f-ae99b689e7a9"
                    }
                ]
            },
            "encounterProviders": [],
            "diagnoses": [],
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632?v=full"
                }
            ],
            "resourceVersion": "2.2"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/encounter?patient=96be32d2-9367-4d1d-a285-79a5e5db12b8&concept=18316c68-b5f9-4986-b76d-9975cd0ebe31&fromdate=2016-10-08&v=default&limit=1&startIndex=1"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Get encounter by Encounter UUID, Patient Identifier or name
patient Patient UUID Get encounter(s) for a patient
encounterType Encounter_Type UUID Filter by encounter type (must be used with patient parameter cant be used independently)
order Order UUID Filter to encounter(s) containing the specified order (must be used with patient)
obsConcept Concept UUID Filter to encounter(s) containing observation(s) for the given concept (must be used with patient parameter cant be used independently)
obsValues String Filter to encounter(s) containing an observations with the given value (must be used with patient and obsConcept parameters together )
fromdate Date or Timestamp (ISO 8601) Start date of the encounter (must be used with patient parameter cant be used independently)
todate Date or Timestamp (ISO 8601) End date of the encounter (must be used with patient parameter cant be used independently)
includeAll Boolean If true, returns also voided Encounters

List encounter by UUID.

List encounter by UUID

GET /encounter/:target_encounter_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=3EFCD2FD54D00BE8491DFFD43AA706DC")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=3EFCD2FD54D00BE8491DFFD43AA706DC");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an encounter

Creating a new Encouter in existing visit

POST /Encounter
{
  "encounterDatetime": "2015-02-24T06:08:25.000+0000",
  "patient": "96be32d2-9367-4d1d-a285-79a5e5db12b8",
  "encounterType": "67a71486-1a54-468f-ac3e-7091a9a79584",
  "location": "58c57d25-8d39-41ab-8422-108a0c277d98",
  "encounterProviders": [
    {
      "provider": "bb1a7781-7896-40be-aaca-7d1b41d843a6",
      "encounterRole": "240b26f9-dd88-4172-823d-4a8bfeb7841f"
    }
  ],
  "visit":"69b3265b-1521-4c27-8d3f-ae99b689e7a9"
}

Creating a new Encouter for a new Visit

POST /Encounter
{
    "encounterDatetime": "2015-02-24T06:08:25.000+0000",
    "patient": "96be32d2-9367-4d1d-a285-79a5e5db12b8",
    "encounterType": "67a71486-1a54-468f-ac3e-7091a9a79584",
    "location": "58c57d25-8d39-41ab-8422-108a0c277d98",
    "encounterProviders": [
        {
            "provider": "bb1a7781-7896-40be-aaca-7d1b41d843a6",
            "encounterRole": "240b26f9-dd88-4172-823d-4a8bfeb7841f"
        }
    ],
    "visit": {
        "patient": "96be32d2-9367-4d1d-a285-79a5e5db12b8",
        "visitType": "7b0f5697-27e3-40c4-8bae-f4049abfb4ed",
        "startDatetime": "2015-02-24T06:08:25.000+0000",
        "stopDatetime" : "2015-02-24T06:09:25.000+0000"
    }
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"encounterDatetime\": \"2015-02-24T06:08:25.000+0000\",\r\n    \"patient\": \"96be32d2-9367-4d1d-a285-79a5e5db12b8\",\r\n    \"encounterType\": \"67a71486-1a54-468f-ac3e-7091a9a79584\",\r\n    \"location\": \"58c57d25-8d39-41ab-8422-108a0c277d98\",\r\n    \"encounterProviders\": [\r\n        {\r\n            \"provider\": \"bb1a7781-7896-40be-aaca-7d1b41d843a6\",\r\n            \"encounterRole\": \"240b26f9-dd88-4172-823d-4a8bfeb7841f\"\r\n        }\r\n    ],\r\n    \"visit\": {\r\n        \"patient\": \"96be32d2-9367-4d1d-a285-79a5e5db12b8\",\r\n        \"visitType\": \"7b0f5697-27e3-40c4-8bae-f4049abfb4ed\",\r\n        \"startDatetime\": \"2015-02-24T06:08:25.000+0000\",\r\n        \"stopDatetime\" : \"2015-02-24T06:09:25.000+0000\"\r\n    }\r\n}\r\n");
Request request = new Request.Builder()
  .url("https://demo.openmrs.org/openmrs/ws/rest/v1/encounter")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=3D897DB2CD0E3465BBCF887F133ED465")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=3D897DB2CD0E3465BBCF887F133ED465");

var raw = JSON.stringify({"encounterDatetime":"2015-02-24T06:08:25.000+0000","patient":"96be32d2-9367-4d1d-a285-79a5e5db12b8","encounterType":"67a71486-1a54-468f-ac3e-7091a9a79584","location":"58c57d25-8d39-41ab-8422-108a0c277d98","encounterProviders":[{"provider":"bb1a7781-7896-40be-aaca-7d1b41d843a6","encounterRole":"240b26f9-dd88-4172-823d-4a8bfeb7841f"}],"visit":{"patient":"96be32d2-9367-4d1d-a285-79a5e5db12b8","visitType":"7b0f5697-27e3-40c4-8bae-f4049abfb4ed","startDatetime":"2015-02-24T06:08:25.000+0000","stopDatetime":"2015-02-24T06:09:25.000+0000"}});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/encounter", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
encounterDatetime Date (ISO8601 Long) The date and time the encounter was created. Should be between visit start and stop dates (required)
patient Patient UUID The patient to whom the encounter applies (Required)
encounterType EncounterType UUID The type of encounter – e.g., Initial visit, Return visit, etc. (required)
location Location UUID The location at which the encounter occurred (required)
encounterProviders Array of Provider UUID and associated Encounter Role UUID An array of providers and their role within the encounter. At least one provider is required
obs Array[]: Obs Array of observations and values for the encounter
orders Array[]: Order UUID List of orders created during the encounter
form Form UUID Target Form UUID to be filled for the encounter
visit Visit UUID When creating an encounter for an existing visit, this specifies the visit this encounter will be grouped into.

Update an encounter

Update an encounter

POST /encounter/:target_encounter_uuid
{
  "encounterDatetime": "2015-02-24T06:08:25.000+0001"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"encounterDatetime\": \"2015-02-24T06:08:25.000+0001\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314");

var raw = JSON.stringify({"encounterDatetime":"2015-02-24T06:08:25.000+0001"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
encounterDatetime Date (ISO8601 Long) The date and time the encounter was created. Should be between visit start and stop dates.
patient Patient UUID The patient to whom the encounter applies
encounterType EncounterType UUID The type of encounter – e.g., Initial visit, Return visit, etc.
location Location UUID The location at which the encounter occurred
encounterProviders Array of Provider UUID and associated Encounter Role UUID An array of providers and their role within the encounter. At least one provider is required
obs Array[]: Obs Array of observations and values for the encounter
orders Array[]: Order UUID List of orders created during the encounter
form Form UUID Target Form UUID to be filled for the encounter
visit Visit UUID When creating an encounter for an existing visit, this specifies the visit this encounter will be grouped into.

Delete an encounter

Delete an encounter

  DELETE /encounter/:target_encounter_uuid?purge=true

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314")
  .build();
Response response = client.newCall(request).execute();

List encounter provider subresources

List encounter provider subresources

GET /encounter/:target_encounter_uuid/encounterprovider 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "7146fea4-af02-4452-b4ed-240e71da7224",
            "provider": {
                "uuid": "bb1a7781-7896-40be-aaca-7d1b41d843a6",
                "display": "doctor - Jake Smith",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/provider/bb1a7781-7896-40be-aaca-7d1b41d843a6"
                    }
                ]
            },
            "encounterRole": {
                "uuid": "240b26f9-dd88-4172-823d-4a8bfeb7841f",
                "display": "Clinician",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f"
                    }
                ]
            },
            "voided": false,
            "links": [
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider/7146fea4-af02-4452-b4ed-240e71da7224?v=full"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

List encounter provider subresources by it's UUID and parent encounter UUID.

List encounter provider subresources by it's UUID

GET /encounter/:target_encounter_uuid/encounterprovider/:target_encounter_provider_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider/7146fea4-af02-4452-b4ed-240e71da7224")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider/7146fea4-af02-4452-b4ed-240e71da7224", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an encounter provider sub resource with properties

Create an encounter provider sub resource with properties

POST encounter/:target_encounter_uuid/encounterprovider 
{
  "provider": "bb1a7781-7896-40be-aaca-7d1b41d843a6",
  "encounterRole": "240b26f9-dd88-4172-823d-4a8bfeb7841f"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"provider\": \"bb1a7781-7896-40be-aaca-7d1b41d843a6\",\r\n  \"encounterRole\": \"240b26f9-dd88-4172-823d-4a8bfeb7841f\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314");

var raw = JSON.stringify({"provider":"bb1a7781-7896-40be-aaca-7d1b41d843a6","encounterRole":"240b26f9-dd88-4172-823d-4a8bfeb7841f"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider", requestOptions)


Update encounter provider subresource

Update encounter provider subresource

POST encounter/:target_encounter_uuid/encounterprovider/:target_encounter_provider_uuid
{
  "encounterRole": "240b26f9-dd88-4172-823d-4a8bfeb7841f"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"encounterRole\": \"240b26f9-dd88-4172-823d-4a8bfeb7841f\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider/7146fea4-af02-4452-b4ed-240e71da7224")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314");

var raw = JSON.stringify({"encounterRole":"240b26f9-dd88-4172-823d-4a8bfeb7841f"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider/7146fea4-af02-4452-b4ed-240e71da7224", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
provider Provider UUID UUID of a provider currently registered in OpenMRS
encounterRole Encounter_Role UUID UUID of encounter role. This is the role provider will participate during this encounter

Delete encounter provider subresource

Delete encounter provider subresource

DELETE /encounter/:target_encounter_uuid/encounterprovider/:target_encounter_provider_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider/7146fea4-af02-4452-b4ed-240e71da7224?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=FEAED37621B56D3A7C0361AD9858D314");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounter/d3360c01-9813-4ff8-bd81-909af6612632/encounterprovider/7146fea4-af02-4452-b4ed-240e71da7224?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Encounter Type

Encounter Type Overview

Available operations for Encounter Type

  1. List encounter types
  2. Create an encounter type
  3. Update an encounter type
  4. Delete an encounter type

List encounter types

List encounter types

GET /encountertype?q=Admission

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype?q=Admission&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();



var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype?q=Admission&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "e22e39fd-7db2-45e7-80f1-60fa0d5a4378",
            "display": "Admission",
            "name": "Admission",
            "description": "Indicates that the patient has been admitted for inpatient care, and is not expected to leave the hospital unless discharged.",
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB",
                    "display": "daemon",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB"
                        }
                    ]
                },
                "dateCreated": "2013-08-01T18:27:27.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype/e22e39fd-7db2-45e7-80f1-60fa0d5a4378"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Query to filter encounter type by its name

Get encounter type by UUID.

Get encounter type by UUID

GET /encountertype/:target_encounter_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype/e22e39fd-7db2-45e7-80f1-60fa0d5a4378")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype/e22e39fd-7db2-45e7-80f1-60fa0d5a4378", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an encounter type

Create an encounter type

POST /encountertype
{
    "name": "Discharge",
    "description": "Attach encounters related to hospital dischargers"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Discharge\",\r\n    \"description\": \"Attach encounters related to hospital dischargers\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var raw = JSON.stringify({"name":"Discharge","description":"Attach encounters related to hospital dischargers"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update an encounter type

Update an encounter type

POST /encountertype/:target_encounter_type_uuid
{
    "description": "Encounters related to discharge from hospital"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"description\": \"Encounters related to discharge from hospital\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype/181820aa-88c9-479b-9077-af92f5364329")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var raw = JSON.stringify({"description":"Encounters related to discharge from hospital"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype/181820aa-88c9-479b-9077-af92f5364329", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete an encounter type

Delete an encounter type

DELETE /encountertype/:target_encounter_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype/181820aa-88c9-479b-9077-af92f5364329?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encountertype/181820aa-88c9-479b-9077-af92f5364329?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


Query Parameters

Parameter Type Description
purge Boolean The resource will be retired unless purge = ‘true’

Encounter Role

Encounter Role Overview

Available operation for Encounter Roles

  1. List encounter roles
  2. Create an encounter role
  3. Update an encounter role
  4. Delete an encounter role

List encounter roles

List encounter roles

GET /encounterrole?q=Clinician&v=full

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounterrole?q=Clinician&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounterrole?q=Clinician&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "240b26f9-dd88-4172-823d-4a8bfeb7841f",
            "display": "Clinician",
            "name": "Clinician",
            "description": "Doctor or Nurse who is the primary provider for an encounter, and will sign the note",
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB",
                    "display": "daemon",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB"
                        }
                    ]
                },
                "dateCreated": "2013-08-02T05:20:48.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Query to filter encounter role by its name

Get encounter role by UUID.

Get encounter role by UUID

GET /encounter/:target_encounter_role_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an encounter role

Create an encounter role

POST /encounterrole
{
    "name": "Clinician",
    "description": "A provider assisting the Lead Surgeon."
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"Clinician\",\r\n    \"description\": \"A provider assisting the Lead Surgeon.\"\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounterrole")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var raw = JSON.stringify({"name":"Clinician","description":"A provider assisting the Lead Surgeon."});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounterrole", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name for the encounter role (required)
description `String Description for the encounter role (required)

Update an encounter role

Update an encounter role

POST /encounterrole/:target_encounter_role_uuid
{
    "description": "A surgeon who assisted the Lead Surgeon"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"description\": \"A surgeon who assisted the Lead Surgeon\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var raw = JSON.stringify({"description":"A surgeon who assisted the Lead Surgeon"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete an encounter role

Delete an encounter role

DELETE /encounterrole/:target_encounter_role_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided unless purge = ‘true’

Concepts

Concepts Overview

Sub Resource types of Concepts

Concept Attribute

Concept Name

Concept Mapping

Concept Description.

Available operations for Concepts

  1. List concepts
  2. Create a concept
  3. Update a concept
  4. Delete a concept
  5. List concept mapping
  6. Create concept mapping with properties
  7. Update concept mapping
  8. Delete concept mapping
  9. List concept name
  10. Create concept name with properties
  11. Update concept name
  12. Delete concept name
  13. List concept attribute
  14. Create concept attribute with properties
  15. Update concept attribute
  16. Delete concept attribute
  17. List concept description
  18. Create concept description with properties
  19. Update concept description
  20. [Delete concept description](#delete-concept-description

List all concepts.

List all concepts

GET /concept?term=38341003&source=SNOMED%20CT&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept?term=38341003&source=SNOMED%20CT&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=6E54C8D18F81C34555DBBB8585951625")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=6E54C8D18F81C34555DBBB8585951625");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept?term=38341003&source=SNOMED%20CT&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "18316c68-b5f9-4986-b76d-9975cd0ebe31",
            "display": "True",
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/concept/18316c68-b5f9-4986-b76d-9975cd0ebe31"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/concept?term=38341003&source=SNOMED+CT&limit=1&startIndex=1"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Display Name of concept object
code String Represents a name from a standard medical code
name String ConceptNames are the words or phrases used to express the idea of a Concept within a particular locale
term String Medical coding term or OpenMRS concept dictionary term that could be mapped to a concept
source String A concept can have any number of mappings to any number of other vocabularies. Other vocabularies are called "concept sources" in OpenMRS (ie. LOINC, SNOMED, ICD-9, ICD10, RxNORM, etc), but the concept source can also be a custom (ie. org.openmrs.module.mdrtb, PIH, AMPATH, MVP, etc.). Every concept can define a string for its mapping in any "concept source" defined in the database
class String The concept's class provides a useful way to narrow down the scope of the information that the concept is intended to capture. In this way, the class is helpful for data extraction. This classification elaborates how a concept will be represented (i.e. as a question or an answer) when the information is stored. OpenMRS contains several default classes to use when defining concepts, but implementation sites may also create additional custom concept classes.

List concept by UUID.

List concept by UUID

GET /concept/:target_concept_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/108AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/108AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept

Create a concept


POST /concept
{
    "names": [
        {
            "name": "What is the blood type for the sick patient?",
            "locale": "en",
            "localePreferred": true,
            "conceptNameType": "FULLY_SPECIFIED"
        }
    ],
    "datatype": "8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
    "version": "1.2.2",
    "conceptClass": "8d492774-c2cc-11de-8d13-0010c6dffd0f",
    "mappings": [
        {
            "conceptReferenceTerm": "21fb14d7-5cd9-3621-ac30-c9e57320e233",
            "conceptMapType": "35543629-7d8c-11e1-909d-c80aa9edcf4e"
        }
    ],
    "descriptions": [
        {
            "description": "Records blood type of sick patients",
            "locale": "en"
        }
    ]
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"names\": [\r\n        {\r\n            \"name\": \"What is the blood type for the sick patient?\",\r\n            \"locale\": \"en\",\r\n            \"localePreferred\": true,\r\n            \"conceptNameType\": \"FULLY_SPECIFIED\"\r\n        }\r\n    ],\r\n    \"datatype\": \"8d4a4c94-c2cc-11de-8d13-0010c6dffd0f\",\r\n    \"version\": \"1.2.2\",\r\n    \"conceptClass\": \"8d492774-c2cc-11de-8d13-0010c6dffd0f\",\r\n    \"mappings\": [\r\n        {\r\n            \"conceptReferenceTerm\": \"21fb14d7-5cd9-3621-ac30-c9e57320e233\",\r\n            \"conceptMapType\": \"35543629-7d8c-11e1-909d-c80aa9edcf4e\"\r\n        }\r\n    ],\r\n    \"descriptions\": [\r\n        {\r\n            \"description\": \"Records blood type of sick patients\",\r\n            \"locale\": \"en\"\r\n        }\r\n    ]\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=FC3F8F0D4A55542536ABB6F2672F727E")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=FC3F8F0D4A55542536ABB6F2672F727E");

var raw = JSON.stringify({"names":[{"name":"What is the blood type for the sick patient?","locale":"en","localePreferred":true,"conceptNameType":"FULLY_SPECIFIED"}],"datatype":"8d4a4c94-c2cc-11de-8d13-0010c6dffd0f","version":"1.2.2","conceptClass":"8d492774-c2cc-11de-8d13-0010c6dffd0f","mappings":[{"conceptReferenceTerm":"21fb14d7-5cd9-3621-ac30-c9e57320e233","conceptMapType":"35543629-7d8c-11e1-909d-c80aa9edcf4e"}],"descriptions":[{"description":"Records blood type of sick patients","locale":"en"}]});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
names String ConceptNames are the words or phrases used to express the idea of a Concept within a particular locale (required)
datatype target_concept_datatype_uuid A concept datatype prescribes the structured format by which you desire the data to be represented. In simple terms, the datatype defines the type of data that the concept is intended to collect (required)
version String A method to keep track of the number of updates applied to a specific concept (required)
answers Array of Child Concepts An array of concepts which are answers for the current concept
setMembers Array of Child Concepts Describes the questions contained by a concept set. Each set member is a question concept in and of itself
units String Standard unit used to measure the concept
allowDecimal String Allow to use decimals
conceptClass target_concept_class_uuid concept class is the classification of a concept This classification details how a concept will be represented (i.e. as a question or an answer) (required)
descriptions Array[] concept-description concept descriptions are clear and concise description of the concept, as agreed upon by the organization's members or the most commonly referenced source
mappings Array[] concept-mapping A concept map connects a concept reference term to a concept

Update a concept

Update a concept

POST /concept/:target_concept_uuid
{
    "names": [
        {
            "name": "What is the blood type for the sick patient?",
            "locale": "en",
            "localePreferred": true,
            "conceptNameType": "FULLY_SPECIFIED"
        }
    ],
    "datatype": "8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
    "version": "1.2.2",
    "conceptClass": "8d492774-c2cc-11de-8d13-0010c6dffd0f",
    "mappings": [
        {
            "conceptReferenceTerm": "21fb14d7-5cd9-3621-ac30-c9e57320e233",
            "conceptMapType": "35543629-7d8c-11e1-909d-c80aa9edcf4e"
        }
    ],
    "descriptions": [
        {
            "description": "Dummy description update for this concept",
            "locale": "en"
        }
    ]
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"names\": [\r\n        {\r\n            \"name\": \"What is the blood type for the sick patient?\",\r\n            \"locale\": \"en\",\r\n            \"localePreferred\": true,\r\n            \"conceptNameType\": \"FULLY_SPECIFIED\"\r\n        }\r\n    ],\r\n    \"datatype\": \"8d4a4c94-c2cc-11de-8d13-0010c6dffd0f\",\r\n    \"version\": \"1.2.2\",\r\n    \"conceptClass\": \"8d492774-c2cc-11de-8d13-0010c6dffd0f\",\r\n    \"mappings\": [\r\n        {\r\n            \"conceptReferenceTerm\": \"21fb14d7-5cd9-3621-ac30-c9e57320e233\",\r\n            \"conceptMapType\": \"35543629-7d8c-11e1-909d-c80aa9edcf4e\"\r\n        }\r\n    ],\r\n    \"descriptions\": [\r\n        {\r\n            \"description\": \"Dummy description update for this concept\",\r\n            \"locale\": \"en\"\r\n        }\r\n    ]\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/49b4cf3b-7dbd-4332-b8bb-a328df04611f")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=FC3F8F0D4A55542536ABB6F2672F727E")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=FC3F8F0D4A55542536ABB6F2672F727E");

var raw = JSON.stringify({"names":[{"name":"What is the blood type for the sick patient?","locale":"en","localePreferred":true,"conceptNameType":"FULLY_SPECIFIED"}],"datatype":"8d4a4c94-c2cc-11de-8d13-0010c6dffd0f","version":"1.2.2","conceptClass":"8d492774-c2cc-11de-8d13-0010c6dffd0f","mappings":[{"conceptReferenceTerm":"21fb14d7-5cd9-3621-ac30-c9e57320e233","conceptMapType":"35543629-7d8c-11e1-909d-c80aa9edcf4e"}],"descriptions":[{"description":"Dummy description update for this concept","locale":"en"}]});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/49b4cf3b-7dbd-4332-b8bb-a328df04611f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
names String ConceptNames are the words or phrases used to express the idea of a Concept within a particular locale
datatype target_concept_datatype_uuid A concept datatype prescribes the structured format by which you desire the data to be represented. In simple terms, the datatype defines the type of data that the concept is intended to collect
version String A method to keep track of the number of updates applied to a specific concept
answers Array of Child Concepts An array of concepts which are answers for the current concept
setMembers Array of Child Concepts Describes the questions contained by a concept set. Each set member is a question concept in and of itself
units String Standard unit used to measure the concept
allowDecimal String Allow to use decimals
conceptClass target_concept_class_uuid concept class is the classification of a concept This classification details how a concept will be represented (i.e. as a question or an answer)
descriptions Array[] concept-description concept descriptions are clear and concise description of the concept, as agreed upon by the organization's members or the most commonly referenced source
mappings Array[] concept-mapping A concept map connects a concept reference term to a concept

Delete a concept

Delete a concept

DELETE /concept/:target_concept_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/108AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/108AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List all concept mappings for a concept.

List all concept mappings for a concept

GET /concept/:target_concept_uuid/mapping?limit=1 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping?limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping?limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "display": "ICD-10-WHO: O03.9",
            "uuid": "145917ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
            "conceptReferenceTerm": {
                "uuid": "0a0933ab-e97e-3f93-b319-8bb20ed50f64",
                "display": "ICD-10-WHO: O03.9",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/conceptreferenceterm/0a0933ab-e97e-3f93-b319-8bb20ed50f64"
                    }
                ]
            },
            "conceptMapType": {
                "uuid": "43ac5109-7d8c-11e1-909d-c80aa9edcf4e",
                "display": "NARROWER-THAN",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/conceptmaptype/43ac5109-7d8c-11e1-909d-c80aa9edcf4e"
                    }
                ]
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/145917ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
                },
                {
                    "rel": "full",
                    "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/145917ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB?v=full"
                }
            ],
            "resourceVersion": "1.9"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping?limit=1&startIndex=1"
        }
    ]
}

List concept mapping by its UUID and parent concept UUID.

List concept mapping by its UUID and parent concept UUID

GET /concept/:target_concept_uuid/mapping/:target_concept_mapping_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/133911ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/133911ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept mapping with properties

Create a concept mapping with properties

POST concept/:target_concept_uuid/mapping
{
  "conceptReferenceTerm": "21fb14d7-5cd9-3621-ac30-c9e57320e233",
  "conceptMapType": "35543629-7d8c-11e1-909d-c80aa9edcf4e"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"conceptReferenceTerm\": \"21fb14d7-5cd9-3621-ac30-c9e57320e233\",\r\n  \"conceptMapType\": \"35543629-7d8c-11e1-909d-c80aa9edcf4e\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/140AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=E84B91CD41B12C89101E366386887CF4")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=E84B91CD41B12C89101E366386887CF4");

var raw = JSON.stringify({"conceptReferenceTerm":"21fb14d7-5cd9-3621-ac30-c9e57320e233","conceptMapType":"35543629-7d8c-11e1-909d-c80aa9edcf4e"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/140AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
conceptReferenceTerm target_concept_reference_term_type_uuid A concept reference term defines a medical coding term or OpenMRS concept dictionary term that could be mapped to a concept (required)
conceptMapType target_concept_map_type_uuid A concept map connects a concept term to a concept (required)

Update a concept mapping

Update a concept mapping

POST concept/:target_concept_uuid/mapping
{
  "conceptReferenceTerm": "21fb14d7-5cd9-3621-ac30-c9e57320e233",
  "conceptMapType": "35543629-7d8c-11e1-909d-c80aa9edcf4e"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"conceptReferenceTerm\": \"21fb14d7-5cd9-3621-ac30-c9e57320e233\",\r\n  \"conceptMapType\": \"35543629-7d8c-11e1-909d-c80aa9edcf4e\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/140AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/101fea18-161e-4f86-9bd6-35300046c2b4")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=E84B91CD41B12C89101E366386887CF4")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=E84B91CD41B12C89101E366386887CF4");

var raw = JSON.stringify({"conceptReferenceTerm":"21fb14d7-5cd9-3621-ac30-c9e57320e233","conceptMapType":"35543629-7d8c-11e1-909d-c80aa9edcf4e"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/140AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/101fea18-161e-4f86-9bd6-35300046c2b4", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
conceptReferenceTerm target_concept_reference_term_type_uuid A concept reference term defines a medical coding term or OpenMRS concept dictionary term that could be mapped to a concept
conceptMapType target_concept_map_type_uuid A concept map connects a concept term to a concept

Delete a concept mapping

Delete a concept mapping

DELETE concept/:target_concept_uuid/mapping/:target_concept_mapping_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/133911ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=ECE2890ED6EC0C39AB31295B5C17E254");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/133911ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided unless purge = ‘true’. Purging will attempt to remove the concept mapping type from the system irreversibly. Concept mapping types that have been used (i.e., are referenced from existing data) cannot be purged.

List all concept names for a concept

List all concept names for a concept

GET /concept/:target_concept_uuid/name?limit=1 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name?limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=E04858F0DEC146C10FA42532E3CD9A77")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=E04858F0DEC146C10FA42532E3CD9A77");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name?limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "display": "GROSSESSE, FAUSSE COUCHE",
            "uuid": "106383BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
            "name": "GROSSESSE, FAUSSE COUCHE",
            "locale": "fr",
            "localePreferred": true,
            "conceptNameType": "FULLY_SPECIFIED",
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/106383BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
                },
                {
                    "rel": "full",
                    "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/106383BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB?v=full"
                }
            ],
            "resourceVersion": "1.9"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name?limit=1&startIndex=1"
        }
    ]
}

List concept name it's UUID and parent concept UUID.

List concept name it's UUID and parent concept UUID

GET /concept/:target_concept_uuid/name/:target_concept_name_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/106383BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=E04858F0DEC146C10FA42532E3CD9A77")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=E04858F0DEC146C10FA42532E3CD9A77");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/106383BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept name with properties

Create a concept name with properties

POST concept/:target_concept_uuid/name
{
  "name": "scabies",
  "locale": "en",
  "localePreferred": true,
  "conceptNameType": null
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"scabies\",\r\n  \"locale\": \"en\",\r\n  \"localePreferred\": true,\r\n  \"conceptNameType\": null\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/140AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=E84B91CD41B12C89101E366386887CF4")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=E84B91CD41B12C89101E366386887CF4");

var raw = JSON.stringify({"name":"scabies","locale":"en","localePreferred":true,"conceptNameType":null});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/140AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update concept name

Update concept name

POST concept/:target_concept_uuid/name/:target_concept_name_uuid
{
  "name": "dummyName",
  "locale": "fr",
  "localePreferred": true,
  "conceptNameType": "FULLY_SPECIFIED"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"dummyName\",\r\n  \"locale\": \"fr\",\r\n  \"localePreferred\": true,\r\n  \"conceptNameType\": \"FULLY_SPECIFIED\"\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/140AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/107925BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=5CF7CD95A415309B0C3E5B583B1CBADF")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=5CF7CD95A415309B0C3E5B583B1CBADF");

var raw = JSON.stringify({"name":"dummyName","locale":"fr","localePreferred":true,"conceptNameType":"FULLY_SPECIFIED"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/140AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/107925BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", requestOptions)
  .then(response => response.text())


Delete concept name

Delete concept name

DELETE concept/:target_concept_uuid/name/:target_concept_name_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/106383BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=E04858F0DEC146C10FA42532E3CD9A77")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=E04858F0DEC146C10FA42532E3CD9A77");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/106383BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List all concept attributes for a concept.

List all concept attributes for a concept

GET /concept/:target_concept_uuid/attribute 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "display": "boolean: true",
            "uuid": "3edce4be-513d-46df-a038-a559a6e71423",
            "attributeType": {
                "uuid": "94bbaf10-e43c-4383-a0a9-69927121ab2e",
                "display": "boolean",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/conceptattributetype/94bbaf10-e43c-4383-a0a9-69927121ab2e"
                    }
                ]
            },
            "value": true,
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute/3edce4be-513d-46df-a038-a559a6e71423"
                },
                {
                    "rel": "full",
                    "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute/3edce4be-513d-46df-a038-a559a6e71423?v=full"
                }
            ],
            "resourceVersion": "2.0"
        }
    ]
}

List concept attribute by its UUID and parent concept UUID.

List concept attribute by its UUID and parent concept UUID

GET /concept/:target_concept_uuid/attribute/:target_concept_attribute_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute/3edce4be-513d-46df-a038-a559a6e71423")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute/3edce4be-513d-46df-a038-a559a6e71423", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept attribute with properties

Create a concept attribute with properties


POST concept/:target_concept_uuid/attribute
{
  "attributeType": "target_concept_attribute_type_uuid",
  "value": "value_for_the_attriute"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n  \"attributeType\": \"94bbaf10-e43c-4383-a0a9-69927121ab2e\",\r\n  \"value\": \"true\"   \r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368");

var raw = JSON.stringify({"attributeType":"94bbaf10-e43c-4383-a0a9-69927121ab2e","value":"true"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
attributeType Attribute_Type UUID Create Attribute from this Concept Attribute Type (required)
value Depends on Attribute_Type Selected Value for the attribute (required)

Update concept attribute

Update concept attribute

POST concept/:target_concept_uuid/attribute
{
  "attributeType": "target_concept_attribute_type_uuid",
  "value": "value_for_the_attriute"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \r\n  \"attributeType\": \"94bbaf10-e43c-4383-a0a9-69927121ab2e\",\r\n  \"value\": \"false\"   \r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute/3edce4be-513d-46df-a038-a559a6e71423")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368");

var raw = JSON.stringify({"attributeType":"94bbaf10-e43c-4383-a0a9-69927121ab2e","value":"false"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute/3edce4be-513d-46df-a038-a559a6e71423", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete concept attribute

Delete concept attribute

DELETE concept/:target_concept_uuid/attribute/:target_concept_attribute_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute/3edce4be-513d-46df-a038-a559a6e71423?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=E39DD93D9C64E5FD6F6CD3C512762368");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/attribute/3edce4be-513d-46df-a038-a559a6e71423?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List concept descriptions

List all concept descriptions for a concept

    GET /concept/:target_concept_uuid/description 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C");

var raw = "";

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "display": "Pregnancy terminated by a spontaneous abortion.",
            "uuid": "49FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
            "description": "Pregnancy terminated by a spontaneous abortion.",
            "locale": "en",
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/49FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
                },
                {
                    "rel": "full",
                    "uri": "/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/49FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF?v=full"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

List concept description by its UUID and parent concept UUID.

List concept description by its UUID and parent concept UUID

GET /concept/:target_concept_uuid/description/:target_concept_description_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/49FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C");

var raw = "";

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/49FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept description with properties

Create a concept description with properties

POST concept/:target_concept_uuid/description
{
  "description": "Pregnancy terminated by spontaneous abortion.",
  "locale": "en"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"description\": \"Pregnancy terminated by spontaneous abortion.\",\r\n  \"locale\": \"en\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C");

var raw = JSON.stringify({"description":"Pregnancy terminated by spontaneous abortion.","locale":"en"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))


Update concept description

Update concept description

POST concept/:target_concept_uuid/description/:target_concept_description_uuid
{
  "description": "Pregnancy terminated by spontaneous abortion/miscarriage",
  "locale": "en"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"description\": \"Pregnancy terminated by spontaneous abortion/miscarriage\",\r\n  \"locale\": \"en\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/7d6b3a32-aa93-4ae5-b222-7fe42e9b052f")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C");

var raw = JSON.stringify({"description":"Pregnancy terminated by spontaneous abortion/miscarriage","locale":"en"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/7d6b3a32-aa93-4ae5-b222-7fe42e9b052f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete concept description

Delete concept description

DELETE concept/:target_concept_uuid/description/:target_concept_description_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/7d6b3a32-aa93-4ae5-b222-7fe42e9b052f")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=8D3CE9C8E6854B5B218C4B09ABA9402C");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/concept/48AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/7d6b3a32-aa93-4ae5-b222-7fe42e9b052f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Concept Source

Concept Source Overview

Available operations for Concept Source.

  1. List concept_source types
  2. Create a concept_source
  3. Update a concept_source type
  4. Delete a concept_source type

List concept source

List all non-retired concept source

GET /conceptsource?q=pih&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptsource?q=pih&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptsource?q=pih&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "fb9aaaf1-65e2-4c18-b53c-16b575f2f385",
            "display": "PIH",
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/conceptsource/fb9aaaf1-65e2-4c18-b53c-16b575f2f385"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/conceptsource?q=pih&limit=1&startIndex=1"
        }
    ]
}

Query Parameters

Parameter Type Description
q String Full or partial match to concept source name. Search is case-insensitive for eg. PIH

Query concept source by UUID

Query concept source by UUID

GET /conceptsource/:target_concept_source_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptsource/1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptsource/1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept source

Create a concept source

POST /conceptsource
{
  "name": "SNOMED CT",
  "description": "SNOMED Preferred mapping",
  "hl7Code": "SCT",
  "uniqueId":"2.16.840.1.113883.6.96"   
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"SNOMED CT\",\r\n  \"description\": \"SNOMED Preferred mapping\",\r\n  \"hl7Code\": \"SCT\",\r\n  \"uniqueId\":\"2.16.840.1.113883.6.96\"\t\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptsource/")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=3359211CFE448283F1CDCE925E43545E")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=3359211CFE448283F1CDCE925E43545E");

var raw = JSON.stringify({"name":"SNOMED CT","description":"SNOMED Preferred mapping","hl7Code":"SCT","uniqueId":"2.16.840.1.113883.6.96"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptsource/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a concept source

Update a concept source

POST /conceptsource/:target_concept_source_type_uuid
{
 "name": "SNOMED CTS",
 "description": "SNOMED Preferred mapping",
 "hl7Code": "SCT"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"SNOMED CTS\",\r\n \"description\": \"SNOMED Preferred mapping\",\r\n \"hl7Code\": \"SCT\"\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptsource/1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D");

var raw = JSON.stringify({"name":"SNOMED CTS","description":"SNOMED Preferred mapping","hl7Code":"SCT"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptsource/1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete a concept source

Delete a concept source

DELETE /conceptsource/:target_concept_source_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptsource/9ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D")
  .build();
Response response = client.newCall(request).execute();

var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptsource/9ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

### Query Parameters

Parameter Type Description
purge Boolean The resource will be voided/retired unless purge = ‘true’

Concept Attribute Type

Concept Attribute Type Overview

Available operations for Concept Attribute Type.

  1. List concept_attribute types
  2. Create a concept_attribute_type
  3. Update a concept_attribute type
  4. Delete a concept_attribute type

List concept attribute types

List all non-retired concept attribute types

GET /conceptattributetype?q=time&limit=1

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptattributetype?q=time&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptattributetype?q=time&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "ecc8e1af-3465-4840-85b8-ec5a2298bdcf",
            "display": "Time Span",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/conceptattributetype/ecc8e1af-3465-4840-85b8-ec5a2298bdcf"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/conceptattributetype?q=time&limit=1&startIndex=1"
        }
    ]
}

List concept attribute type by UUID.

List concept attribute type by UUID

GET /conceptattributetype/:target_concept_attribute_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptattributetype?ecc8e1af-3465-4840-85b8-ec5a2298bdcf")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptattributetype?ecc8e1af-3465-4840-85b8-ec5a2298bdcf", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept attribute type

Create a concept attribute type

POST /conceptattributetype
{
  "name": "Time Span",
  "description": "This attribute type will record the time span for the concept",
  "datatypeClassname": "org.openmrs.customdatatype.datatype.LongFreeTextDatatype",
  "minOccurs": 0,
  "maxOccurs": 1,
  "datatypeConfig": "default",
  "preferredHandlerClassname": "org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler",
  "handlerConfig": null
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Time Span\",\r\n  \"description\": \"This attribute type will record the time span for the concept\",\r\n  \"datatypeClassname\": \"org.openmrs.customdatatype.datatype.LongFreeTextDatatype\",\r\n  \"minOccurs\": 0,\r\n  \"maxOccurs\": 1,\r\n  \"datatypeConfig\": \"default\",\r\n  \"preferredHandlerClassname\": \"org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler\",\r\n  \"handlerConfig\": null\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptattributetype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=7F21B551667D3B99C226980B29262DAF")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=7F21B551667D3B99C226980B29262DAF");

var raw = JSON.stringify({"name":"Time Span","description":"This attribute type will record the time span for the concept","datatypeClassname":"org.openmrs.customdatatype.datatype.LongFreeTextDatatype","minOccurs":0,"maxOccurs":1,"datatypeConfig":"default","preferredHandlerClassname":"org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler","handlerConfig":null});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptattributetype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the concept attribute type (Required)
description String Description (Required)
datatypeClassname CustomDataType Resource Data type for the attribute type resource. OpenMRS provides Custom data type resource which gives flexibility to select the data type accordingly (Required)
minOccurs Number Minimum number of times this value can be specified for a single concept. Use 0 or 1 as the default value (Required)
maxOccurs Number Maximum number of times this value can be specified for a single concept (e.g., use 1 to prevent an attribute from being added to a concept multiple times)
preferredHandlerClassname Handler Specifies the Java class to be used when handling this concept attribute type. The java class must implement CustomDataTypeHandler. If not specified, the system will try to choose the best handler for the chosen datatype
datatypeConfig String Provides ability to define custom data types configuration for OpenMRS
handlerConfig String Allow handler to be used for more than one attribute type. The actual configuration depends on the needs of the specified handler. For example, a "Pre-defined List" handler could be made to implement a simple selection list, and this configuration would tell the handler the possible choices in the list for this specific attribute type

Update a concept attribute type

Update a concept attribute type

POST /conceptattributetype/:target_concept_attribute_type_uuid
{
  "name": "Time Span",
  "description": "Dummy description update",
  "datatypeClassname": "org.openmrs.customdatatype.datatype.LongFreeTextDatatype",
  "minOccurs": 0,
  "maxOccurs": 1,
  "datatypeConfig": "default",
  "preferredHandlerClassname": "org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler",
  "handlerConfig": null
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Time Span\",\r\n  \"description\": \"Dummy description update\",\r\n  \"datatypeClassname\": \"org.openmrs.customdatatype.datatype.LongFreeTextDatatype\",\r\n  \"minOccurs\": 0,\r\n  \"maxOccurs\": 1,\r\n  \"datatypeConfig\": \"default\",\r\n  \"preferredHandlerClassname\": \"org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler\",\r\n  \"handlerConfig\": null\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptattributetype/b5d56fd4-9add-4c00-a227-eb69d70669dd")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=7F21B551667D3B99C226980B29262DAF")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=7F21B551667D3B99C226980B29262DAF");

var raw = JSON.stringify({"name":"Time Span","description":"Dummy description update","datatypeClassname":"org.openmrs.customdatatype.datatype.LongFreeTextDatatype","minOccurs":0,"maxOccurs":1,"datatypeConfig":"default","preferredHandlerClassname":"org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler","handlerConfig":null});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptattributetype/b5d56fd4-9add-4c00-a227-eb69d70669dd", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the concept attribute type
description String Description
datatypeClassname CustomDataType Resource Data type for the attribute type resource. OpenMRS provides Custom data type resource which gives flexibility to select the data type accordingly
minOccurs Number Minimum number of times this value can be specified for a single concept. Use 0 or 1 as the default value
maxOccurs Number Maximum number of times this value can be specified for a single concept (e.g., use 1 to prevent an attribute from being added to a concept multiple times)
preferredHandlerClassname Handler Specifies the Java class to be used when handling this concept attribute type. The java class must implement CustomDataTypeHandler. If not specified, the system will try to choose the best handler for the chosen datatype
datatypeConfig String Provides ability to define custom data types configuration for OpenMRS
handlerConfig String Allow handler to be used for more than one attribute type. The actual configuration depends on the needs of the specified handler. For example, a "Pre-defined List" handler could be made to implement a simple selection list, and this configuration would tell the handler the possible choices in the list for this specific attribute type

Delete a concept attribute type

Delete a concept attribute type

DELETE /conceptattributetype/:target_concept_attribute_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptattributetype/ecc8e1af-3465-4840-85b8-ec5a2298bdcf?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptattributetype/ecc8e1af-3465-4840-85b8-ec5a2298bdcf?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Concept Data Type

Concept Data Type Overview

Current types are as follows:

1. Numeric

Any data represented numerically, also allows you to classify critical values and units, e.g., age, height, and liters consumed per day.

2. Coded

Allows answers to be only those provided, since value determined by term dictionary lookup (i.e., term identifier) e.g., blood type can only be “A,” “B,” "AB," or “O.”.

3. Text

Open-ended responses.

4. N/A

The standard datatype for any non-query-like concepts (answers or things), e.g., symptoms, diagnoses, findings, anatomy, misc.

5. Document

Pointer to a binary or text-based document (e.g., clinical document, RTF, XML, EKG, image, etc.) stored in complex_obs table.

6. Date

Structured day, month, and year.

7. Time

Structured time response.

8. DateTime

Structured response including both the date and the time

9. Boolean

Checkbox response, e.g., yes or no queries

10. Rule

Value derived from other data

11. Structured Numeric

Complex numeric values possible (ie, <5, 1-10, etc.).

12. Complex

Complex value, analogous to HL7 Embedded Datatype.

Available operations for Concept Data Type.

  1. List concept_data types
  2. Delete a concept_data type

List concept data types

List all non-retired concept data types.

List all non-retired concept data types

GET /conceptdatatype"

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptdatatype?limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptdatatype?limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success response

{
    "results": [
        {
            "uuid": "8d4a4488-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Numeric",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/conceptdatatype?limit=1&startIndex=1"
        }
    ]
}

Get concept data type by UUID.

Get concept data type by UUID

GET /conceptdatatype/:target_concept_data_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete a concept data type

Delete a concept data type

DELETE /conceptdatatype/:target_concept_data_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Concept Map Type

Overview

Available operations.

  1. List concept mapping types
  2. Create a concept mapping type
  3. Update a concept mapping typee
  4. Delete a concept mapping type

List concept map types

List all non-retired concept map types

  GET /conceptmaptype?q=associated

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptmaptype?q=associated&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptmaptype?q=associated&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "55e02065-7d8c-11e1-909d-c80aa9edcf4e",
            "display": "Associated finding",
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/conceptmaptype?q=associated&limit=1&startIndex=1"
        }
    ]
}

List concept map type by UUID.

List concept map type by UUID

  GET /conceptmaptype/:target_concept_map_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept map type

Create a concept map type

POST /conceptmaptype
{
    "name": "SAME-AS",
    "description": "used to map concepts which are Identical",
    "isHidden": false
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n\t\"name\": \"SAME-AS\",\r\n\t\"description\":\"used to map concepts which are Identical\",\r\n\t\"isHidden\": false\r\n}\r\n{\r\n\t\"name\": \"SAME-AS\",\r\n\t\"description\":\"used to map concepts which are Identical\"\r\n\t\"isHidden\": false\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1//conceptmaptype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F");

var raw = "{\n  \"name\": \"SAME-AS\",\n    \"description\":\"used to map concepts which are Identical\",\n \"isHidden\": false\n}\n{\n \"name\": \"SAME-AS\",\n    \"description\":\"used to map concepts which are Identical\"\n  \"isHidden\": false\n}\n";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1//conceptmaptype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the concept mapping type (Required)
description String A brief description of the concept mapping type
isHidden Boolean State to record concept map is hidden or not

Update a concept map type

Update a concept map type

POST /conceptmaptype/:target_concept_map_type_uuid
{
  "name": "SAME-AS",
  "description": "dummy update",
  "isHidden": true
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n\t\"name\": \"SAME-AS\",\r\n\t\"description\": \"dummy update\",\r\n\t\"isHidden\": false\r\n}\r\n{\r\n\t\"name\": \"SAME-AS\",\r\n\t\"description\":\"used to map concepts which are Identical\"\r\n\t\"isHidden\": false\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1//conceptmaptype/35543629-7d8c-11e1-909d-c80aa9edcf4e")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F");

var raw = "{\n  \"name\": \"SAME-AS\",\n    \"description\": \"dummy update\",\n    \"isHidden\": false\n}\n{\n \"name\": \"SAME-AS\",\n    \"description\":\"used to map concepts which are Identical\"\n  \"isHidden\": false\n}\n";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1//conceptmaptype/35543629-7d8c-11e1-909d-c80aa9edcf4e", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete a concept map type

Delete a concept map type

DELETE /conceptmaptype/:target_concept_map_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Concept Reference Term

Overview

Available operations

  1. List concept reference terms
  2. Create a concept reference term
  3. Update a concept reference term
  4. Delete a concept reference term

List concept reference terms

List all concepts reference terms

GET /conceptreferenceterm?codeOrName=274663001

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptreferenceterm?codeOrName=274663001")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=4F55735593751E224686B006CD388234")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=4F55735593751E224686B006CD388234");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptreferenceterm?codeOrName=274663001", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "c4091da9-3d7c-37c8-906d-51183e750629",
            "display": "SNOMED CT: 274663001",
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/conceptreferenceterm/c4091da9-3d7c-37c8-906d-51183e750629"
                }
            ]
        }
    ]
}

Query Parameters

Parameter Type Description
codeOrName String Represents a code or name from a standard medical code
source String A concept can have any number of mappings to any number of other vocabularies. Other vocabularies are called "concept sources" in OpenMRS (i.e., LOINC, SNOMED, ICD-9, ICD10, RxNORM, etc.), but the concept source can also be a custom (i.e., org.openmrs.module.mdrtb, PIH, AMPATH, MVP, etc.). Every concept can define a string for its mapping in any "concept source" defined in the database

Query concept reference term by UUID.

Query concept reference term by UUID

GET /conceptreferenceterm/:target_concept_reference_term_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptreferenceterm/c4091da9-3d7c-37c8-906d-51183e750629")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=4F55735593751E224686B006CD388234")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=4F55735593751E224686B006CD388234");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptreferenceterm/c4091da9-3d7c-37c8-906d-51183e750629", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept reference term

Create a concept reference term


POST /conceptreferenceterm
{
  "name": "Acute Pain", 
  "code": "274663001", 
  "description": "description for the concept reference term"   
  "conceptSource": "1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
  "version": "1.0.0"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Acute Pain\",\t\r\n  \"code\": \"274663001\", \r\n  \"description\": \"description for the concept reference term\",\t\r\n  \"conceptSource\": \"1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\",\r\n  \"version\": \"1.0.0\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptreferenceterm")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=B369B31B00020CC1488C42325A76272B")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=B369B31B00020CC1488C42325A76272B");

var raw = JSON.stringify({"name":"Acute Pain","code":"274663001","description":"description for the concept reference term","conceptSource":"1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD","version":"1.0.0"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptreferenceterm", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
names String Name for the concept reference term
description String A brief description of the concept reference term
code String Represents a name from a standard medical code (required)
conceptSource target_concept_source_UUID A concept can have any number of mappings to any number of other vocabularies. Other vocabularies are called "concept sources" in OpenMRS (i.e., LOINC, SNOMED, ICD-9, ICD10, RxNORM, etc.), but the concept source can also be a custom (i.e., org.openmrs.module.mdrtb, PIH, AMPATH, MVP, etc.). Every concept can define a string for its mapping in any "concept source" defined in the database (required)
version String A method to keep track of the number of updates applied to a specific concept reference term type

Update a concept reference term

Update a concept reference term


POST /conceptreferenceterm/:target_concept_reference_term_type_uuid
{
  "name": "Acute Pain", 
  "code": "274663001", 
  "description": "Modified description for the concept reference term"  
  "conceptSource": "1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
  "version": "1.0.0"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Acute Pain\",\t\r\n  \"code\": \"274663001\", \r\n  \"description\": \"description for the concept reference term\",\t\r\n  \"conceptSource\": \"1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\",\r\n  \"version\": \"1.0.0\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptreferenceterm/c4091da9-3d7c-37c8-906d-51183e750629")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=B369B31B00020CC1488C42325A76272B")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=B369B31B00020CC1488C42325A76272B");

var raw = JSON.stringify({"name":"Acute Pain","code":"274663001","description":"description for the concept reference term","conceptSource":"1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD","version":"1.0.0"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptreferenceterm/c4091da9-3d7c-37c8-906d-51183e750629", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

### Attributes

Parameter Type Description
names String Name for the concept reference term
description String A brief description of the concept reference term
code String Represents a name from a standard medical code (required)
conceptSource target_concept_source_UUID A concept can have any number of mappings to any number of other vocabularies. Other vocabularies are called "concept sources" in OpenMRS (i.e., LOINC, SNOMED, ICD-9, ICD10, RxNORM, etc.), but the concept source can also be a custom (i.e., org.openmrs.module.mdrtb, PIH, AMPATH, MVP, etc.). Every concept can define a string for its mapping in any "concept source" defined in the database (required)
version String A method to keep track of the number of updates applied to a specific concept reference term type

Delete a concept reference term

Delete a concept reference term

DELETE /conceptreferenceterm/:target_concept_reference_term_type_uuid?purge=true    

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptreferenceterm/c4091da9-3d7c-37c8-906d-51183e750629?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=B369B31B00020CC1488C42325A76272B")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=B369B31B00020CC1488C42325A76272B");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptreferenceterm/c4091da9-3d7c-37c8-906d-51183e750629?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Concept Class

Overview

Available operations.

  1. List concept classes
  2. Create a concept class
  3. Update a concept class
  4. Delete a concept class

List concept classes

List all non-retired concept classes

GET /conceptclass?limit=1
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptclass?limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=4C92FA7F3401680513E023F3832D82FF")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=4C92FA7F3401680513E023F3832D82FF");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptclass?limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Test",
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/conceptclass?limit=1&startIndex=1"
        }
    ]
}

List concept class type by UUID.

List concept class type by UUID

GET /conceptclass/:target_concept_class_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a concept class

Create a concept class

POST /conceptclass
{
  "name": "Procedure",
  "description": "Describes a clinical procedure"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n          \"name\": \"Procedure\",\r\n          \"description\": \"Describes a clinical procedure\"\r\n        }");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptclass/")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B");

var raw = JSON.stringify({"name":"Procedure","description":"Describes a clinical procedure"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptclass/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

### Attributes

Parameter Type Description
name String Name of the concept class (Required)
description String Description

Update a concept class

Update a concept class

POST /conceptclass/:target_concept_class_uuid
{
  "name": "Procedure",
  "description": "Updating the dummy description"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptclass/8afb1247-9c8c-48c4-9253-946ffd44bc8a")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B");

var raw = JSON.stringify({"name":"Procedure","description":"Updating the dummy description"});

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptclass/8afb1247-9c8c-48c4-9253-946ffd44bc8a", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))


Attributes

Parameter Type Description
name String Name of the concept class
description String Description

Delete a concept class

Delete a concept class

DELETE /conceptclass/:target_concept_class_uuid?purge=true


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptclass/8afb1247-9c8c-48c4-9253-946ffd44bc8a?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptclass/8afb1247-9c8c-48c4-9253-946ffd44bc8a?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided/retired unless purge = ‘true’

Concept Proposal

Concept Proposal Overview

Available operations.

  1. List Concept Proposals
  2. Create a Concept Proposal
  3. Update a Concept Proposal
  4. Delete a Concept Proposal
  5. Ignore a Concept Proposal
  6. Convert a Concept Proposal

List Concept Proposals

List Concept Proposals

GET /conceptproposal
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptproposal")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptproposal", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "d9adb319-f634-4764-b8ac-7c55a302b656",
            "encounter": null,
            "originalText": "test",
            "state": "UNMAPPED",
            "creator": {
                "uuid": "1c3db49d-440a-11e6-a65c-00e04c680037",
                "display": "admin",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/user/1c3db49d-440a-11e6-a65c-00e04c680037",
                        "resourceAlias": "user"
                    }
                ]
            },
            "dateCreated": "2021-07-20T21:16:33.000+0200",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptproposal/d9adb319-f634-4764-b8ac-7c55a302b656",
                    "resourceAlias": "conceptproposal"
                }
            ]
        }
    ]
}

Retrieve all Concept Proposals. If the user is not logged in to perform this action, a 401 Unauthorized status returned. You can also pass query parameters to add sorting or filtering to your query.

Query Parameters

Parameter Type Description
includeCompleted Boolean If true, will also include mapped proposals
sortOn String If set to "originalText" then will sort proposals alphabetically by original text. If set to "occurrences" then will sort proposals by number of occurrences of given original text.
sortOrder String Order of sorting, "asc" or "desc".

List Concept Proposal by UUID.

List Concept Proposal by UUID

GET /conceptproposal/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptproposal/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptproposal/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retrieve a concept proposal by its UUID. Returns a 404 Not Found status if proposal does not exist. If user not logged in to perform this action, a 401 Unauthorized status returned.

Create a Concept Proposal

Create a Concept Proposal

POST /conceptproposal
{
    "originalText": "text",
    "mappedConcept": "a95e0f2a-915e-42bb-ae9a-92248ff85e8c",
    "encounter": "b93eafe5-a6d0-45c8-8429-f3c38dc382e7",
    "obsConcept": "a95e0f2a-915e-42bb-ae9a-92248ff85e8c"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"originalText\": \"text\",\"mappedConcept\": \"a95e0f2a-915e-42bb-ae9a-92248ff85e8c\",\"encounter\": \"b93eafe5-a6d0-45c8-8429-f3c38dc382e7\",\"obsConcept\": \"a95e0f2a-915e-42bb-ae9a-92248ff85e8c\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptproposal")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F");

var raw = JSON.stringify({"originalText": "text","mappedConcept": "a95e0f2a-915e-42bb-ae9a-92248ff85e8c","encounter": "b93eafe5-a6d0-45c8-8429-f3c38dc382e7","obsConcept": "a95e0f2a-915e-42bb-ae9a-92248ff85e8c"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptproposal", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To create a Concept Proposal, you need to specify below attributes in the request body. If you are not logged in to perform this action, a 401 Unauthorized status returned.

Attributes

Parameter Type Description
originalText String Name of the concept proposal (Required)
mappedConcept Concept_UUID UUID of Concept that you want to map this proposal to
encounter Encounter_UUID UUID of Encounter that will be used for creating Observation
obsConcept Concept_UUID UUID of Concept that will be used for creating Observation

Update a Concept Proposal

Update a Concept Proposal

POST /conceptproposal/:uuid
{
    "finalText": "text",
    "comments": "comments",
    "mappedConcept": "a95e0f2a-915e-42bb-ae9a-92248ff85e8c",
    "encounter": "b93eafe5-a6d0-45c8-8429-f3c38dc382e7",
    "obsConcept": "a95e0f2a-915e-42bb-ae9a-92248ff85e8c"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"finalText\": \"text\",\"comments\": \"comments\",\"mappedConcept\": \"a95e0f2a-915e-42bb-ae9a-92248ff85e8c\",\"encounter\": \"b93eafe5-a6d0-45c8-8429-f3c38dc382e7\",\"obsConcept\": \"a95e0f2a-915e-42bb-ae9a-92248ff85e8c\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptproposal/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F")
  .build();
Response response = client.newCall(request).execute();

var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"finalText": "text","comments": "comments","mappedConcept": "a95e0f2a-915e-42bb-ae9a-92248ff85e8c","encounter": "b93eafe5-a6d0-45c8-8429-f3c38dc382e7","obsConcept": "a95e0f2a-915e-42bb-ae9a-92248ff85e8c"});

var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptproposal/:uuid", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

Update a Concept Proposal with given UUID, this method only modifies properties in the request. Returns a 404 Not Found status if proposal does not exist. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

Attributes

Parameter Type Description
finalText String Final name of the concept proposal (Required)
comments String Comments of the concept proposal. Will be shared with other proposal creators.
mappedConcept Concept_UUID UUID of Concept that you want to map this proposal to
encounter Encounter_UUID UUID of Encounter that will be used for creating Observation
obsConcept Concept_UUID UUID of Concept that will be used for creating Observation

Delete a Concept Proposal

Delete a Concept Proposal

DELETE /conceptproposal/:uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptproposal/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptproposal/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Ignore a Concept Proposal

Ignore a Concept Proposal

POST /conceptproposal/:uuid
{
    "action": "ignore"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"action\": \"ignore\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptproposal/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"action": "ignore"});

var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptproposal/:uuid", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

Ignore a Concept Proposal with given UUID. This method will also ignore any other proposals with the same original name. Returns a 404 Not Found status if proposal does not exist. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

Convert a Concept Proposal

Convert a Concept Proposal

POST /conceptproposal/:uuid
{
  "action": "convert",
  "actionToTakeOnConvert": "saveAsMapped",
  "conceptNameLocale": "en"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"action\": \"convert\",\"actionToTakeOnConvert\": \"saveAsMapped\",\"conceptNameLocale\": \"en\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptproposal/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"action": "convert","actionToTakeOnConvert": "saveAsMapped","conceptNameLocale": "en"});

var requestOptions = {
    method: 'POST',
    headers: myHeaders,
    body: raw,
    redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/conceptproposal/:uuid", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

Map a Concept Proposal with given UUID. This method will also map any other proposals with the same original name. Returns a 404 Not Found status if proposal does not exist. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

Attributes

Parameter Type Description
action String Has to be set to "convert" (Required)
actionToTakeOnConvert String If set to "saveAsSynonym", proposal will be mapped to concept's synonym. If set to "saveAsMapped" then will map proposal to observation based on encounter and obsConcept. (Required)
conceptNameLocale String Language code of proposal's text (future concept name)

Concept Stop Word

Available Operations for Concept Stop Word

  1. List Stop Words
  2. Create a Stop Word
  3. Update a Stop Word
  4. Delete a Stop Word

List Stop Words

List Stop Words shell GET /conceptstopword

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstopword")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");
var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstopword", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "f5f45540-e2a7-11df-87ae-18a905e044dc",
            "display": "A",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f45540-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f469ae-e2a7-11df-87ae-18a905e044dc",
            "display": "AND",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f469ae-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f47070-e2a7-11df-87ae-18a905e044dc",
            "display": "AT",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f47070-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f476c4-e2a7-11df-87ae-18a905e044dc",
            "display": "BUT",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f476c4-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f47d04-e2a7-11df-87ae-18a905e044dc",
            "display": "BY",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f47d04-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f4834e-e2a7-11df-87ae-18a905e044dc",
            "display": "FOR",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f4834e-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f48a24-e2a7-11df-87ae-18a905e044dc",
            "display": "HAS",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f48a24-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f49064-e2a7-11df-87ae-18a905e044dc",
            "display": "OF",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f49064-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f496ae-e2a7-11df-87ae-18a905e044dc",
            "display": "THE",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f496ae-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        },
        {
            "uuid": "f5f49cda-e2a7-11df-87ae-18a905e044dc",
            "display": "TO",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstopword/f5f49cda-e2a7-11df-87ae-18a905e044dc",
                    "resourceAlias": "conceptstopword"
                }
            ]
        }
    ]
}

Fetch all Concept Stop Words. Returns a 200 OK status with the Concept Stop Words response. If user not logged in to perform this action, a 401 Unauthorized status is returned.

List Concept Stop Word by UUID.

List Concept Stop Word by UUID shell GET /conceptstopword/:uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstopword/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");
var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstopword/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retrieve a Concept Stop Word by its UUID. Returns a 404 Not Found status if stop word does not exist. If user not logged in to perform this action, a 401 Unauthorized status is returned.

Create a Stop Word

Create a Stop Word

POST /conceptstopword
{
    "value": "AND",
    "locale": "en"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"value\": \"AND\",\"locale\": \"en\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstopword")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");
var raw = JSON.stringify({"value": "AND","locale": "en"});
var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstopword", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To create a Concept Stop Word you need to specify the below properties in the request body. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
value String Word text
locale String Language code of the value string

Update a Stop Word

Update a Stop Word

POST /conceptstopword/:uuid
{
    "value": "AND",
    "locale": "en"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"value\": \"AND\",\"locale\": \"en\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstopword/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");
var raw = JSON.stringify({"value": "AND","locale": "en"});
var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstopword/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a Concept Stop Word. This method only modifies properties specified in the request. Returns a 404 Not found if stop word does not exist. If not authenticated or authenticated user does not have sufficient privileges, 401 Unauthorized status is returned.

Properties

Parameter Type Description
value String Word text
locale String Language code of the value string

Delete a Stop Word

Delete a Stop Word

DELETE /conceptstopword/:uuid?purge=true
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstopword/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");
var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstopword/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Deletes a Concept Stop Word by its UUID. Returns a 404 Not Found status if stop word does not exist. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

This resource doesn't support voiding/retiring.

Drugs

Available operations for Drugs

  1. List drugs
  2. Create a drug
  3. Update a drug
  4. Delete a drug

List drugs

List drugs

GET /drug
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/drug")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/drug", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "display": "test",
            "uuid": "1d0050db-bd0b-42fb-9e60-cd50c177e922",
            "name": "test",
            "description": null,
            "retired": false,
            "dosageForm": null,
            "maximumDailyDose": null,
            "minimumDailyDose": null,
            "concept": {
                "uuid": "08e5f67d-b63e-4f99-a09b-e6193125cf77",
                "display": "drug test",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/08e5f67d-b63e-4f99-a09b-e6193125cf77",
                        "resourceAlias": "concept"
                    }
                ]
            },
            "combination": false,
            "strength": null,
            "drugReferenceMaps": [],
            "ingredients": [],
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/drug/1d0050db-bd0b-42fb-9e60-cd50c177e922",
                    "resourceAlias": "drug"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/drug/1d0050db-bd0b-42fb-9e60-cd50c177e922?v=full",
                    "resourceAlias": "drug"
                }
            ],
            "resourceVersion": "1.12"
        }
    ]
}

Quickly filter drugs with given query parameters. Add parameter includeAll=true to also retrieve retired drugs. If not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
q Search Query Filter drugs by their name
includeAll Boolean If true, returns also retired drugs

Get a drug by UUID.

Get a drug by UUID

GET /drug/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/drug/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/drug/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a drug

Create a drug

{
    "concept": "08e5f67d-b63e-4f99-a09b-e6193125cf77",
    "combination": true,
    "name": "drug name",
    "minimumDailyDose": 1,
    "maximumDailyDose": 5,
    "dosageForm": "08e5f67d-b63e-4f99-a09b-e6193125cf77"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"concept\": \"08e5f67d-b63e-4f99-a09b-e6193125cf77\",\"combination\": true,\"name\": \"drug name\",\"minimumDailyDose\": 1,\"maximumDailyDose\": 5,\"dosageForm\": \"08e5f67d-b63e-4f99-a09b-e6193125cf77\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/drug")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"concept": "08e5f67d-b63e-4f99-a09b-e6193125cf77","combination": true,"name": "drug name","minimumDailyDose": 1,"maximumDailyDose": 5,"dosageForm": "08e5f67d-b63e-4f99-a09b-e6193125cf77"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/drug", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To create a drug you need to specify below properties in your request body. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

Attributes

Parameter Type Description
concept Concept_UUID Concept describing this drug
combination Boolean Is this drug a combination
name String Name of a drug
minimumDailyDose Double Minimum drug daily dose
maximumDailyDose Double Maximum drug daily dose
dosageForm Concept_UUID Concept describing dosage form of this drug

Update a drug

Update a drug by its UUID

{
    "concept": "08e5f67d-b63e-4f99-a09b-e6193125cf77",
    "combination": true,
    "name": "drug name",
    "minimumDailyDose": 1,
    "maximumDailyDose": 5,
    "dosageForm": "08e5f67d-b63e-4f99-a09b-e6193125cf77"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"concept\": \"08e5f67d-b63e-4f99-a09b-e6193125cf77\",\"combination\": true,\"name\": \"drug name\",\"minimumDailyDose\": 1,\"maximumDailyDose\": 5,\"dosageForm\": \"08e5f67d-b63e-4f99-a09b-e6193125cf77\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/drug/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"concept": "08e5f67d-b63e-4f99-a09b-e6193125cf77","combination": true,"name": "drug name","minimumDailyDose": 1,"maximumDailyDose": 5,"dosageForm": "08e5f67d-b63e-4f99-a09b-e6193125cf77"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/drug/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To update a drug you need to specify below properties in your request body. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

Attributes

Parameter Type Description
concept Concept_UUID Concept describing this drug
combination Boolean Is this drug a combination
name String Name of a drug
minimumDailyDose Double Minimum drug daily dose
maximumDailyDose Double Maximum drug daily dose
dosageForm Concept_UUID Concept describing dosage form of this drug

Delete a drug

Delete a drug by its UUID

DELETE /drug/:uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/drug/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=154692F02BBBC664825F3C4C224A474B")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/drug/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete or retire a drug by its UUID. Returns a 404 Not Found status if the drug does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
purge Boolean The resource will be retired unless purge = ‘true’

Program

Program Overview

A program is typically used when a patient is identified as belonging to a group for which a particular set of coordinated interventions is to be followed. For example, programs might be used for diseases such as HIV or tuberculosis or conditions such as pregnancy or interventions such as childhood immunization.

Available Operations for Program type

  1. List Programs
  2. Create a Program
  3. Update a Program
  4. Delete a Program

List Programs

List Programs

GET /program
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/program")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/program", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "959dc77c-7c2a-4f0d-9c4e-3a8f48c488e2",
            "name": "malaria",
            "allWorkflows": [
                {
                    "uuid": "65fd8425-1090-4a24-8db6-c89aa80daa5d",
                    "concept": {
                        "uuid": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                        "display": "Malaria",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                                "resourceAlias": "concept"
                            }
                        ]
                    },
                    "retired": false,
                    "states": [
                        {
                            "uuid": "f0f0c506-a969-4a3b-84dc-d5d7057b9fcd",
                            "retired": false,
                            "concept": {
                                "uuid": "11034efc-1b2b-4cda-a414-74786a76b800",
                                "display": "dead",
                                "links": [
                                    {
                                        "rel": "self",
                                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800",
                                        "resourceAlias": "concept"
                                    }
                                ]
                            },
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/f0f0c506-a969-4a3b-84dc-d5d7057b9fcd",
                                    "resourceAlias": "state"
                                }
                            ]
                        },
                        {
                            "uuid": "ce13f1c0-742a-415b-91ad-a0b1bd888bc8",
                            "retired": false,
                            "concept": {
                                "uuid": "51d62167-7642-489b-ad0a-79b3b8654882",
                                "display": "cured",
                                "links": [
                                    {
                                        "rel": "self",
                                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882",
                                        "resourceAlias": "concept"
                                    }
                                ]
                            },
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/ce13f1c0-742a-415b-91ad-a0b1bd888bc8",
                                    "resourceAlias": "state"
                                }
                            ]
                        },
                        {
                            "uuid": "535c60a7-d349-4a36-97d0-898e938cdd6f",
                            "retired": false,
                            "concept": {
                                "uuid": "160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                                "display": "Malaria, confirmed",
                                "links": [
                                    {
                                        "rel": "self",
                                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                                        "resourceAlias": "concept"
                                    }
                                ]
                            },
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/535c60a7-d349-4a36-97d0-898e938cdd6f",
                                    "resourceAlias": "state"
                                }
                            ]
                        }
                    ],
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d",
                            "resourceAlias": "workflow"
                        }
                    ]
                }
            ],
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/program/959dc77c-7c2a-4f0d-9c4e-3a8f48c488e2",
                    "resourceAlias": "program"
                }
            ]
        }
    ]
}

Fetch all Programs that match the search query parameter, otherwise fetch all Programs. Returns a 200 OK status with the Programs response. If user not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
q Search Query Display Name of program.

List Program by UUID.

List Program by UUID

GET /program/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/program/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/program/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retrieve a Program by its UUID. Returns a 404 Not Found status if program does not exist. If user not logged in to perform this action, a 401 Unauthorized status is returned.

Create a Program

Create a Program

POST /program
{
    "name": "program",
    "description": "program",
    "concept": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "retired": false,
    "outcomesConcept": "5c938680-c300-4fc0-9a72-e798220f287b"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"name\": \"program\",\n    \"description\": \"program\",\n    \"concept\": \"116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\n    \"retired\": false,\n    \"outcomesConcept\": \"5c938680-c300-4fc0-9a72-e798220f287b\"\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/program")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var raw = JSON.stringify({"name": "program","description": "program","concept":"116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","retired": false,"outcomesConcept": "5c938680-c300-4fc0-9a72-e798220f287b"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/program", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To create a program you need to specify the below properties in the request body. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
name String Name of the program
description String Description of the program
retired Boolean Is program retired
concept Concept_UUID Concept resource UUID (Required)
outcomesConcept Concept_UUID Concept resource UUID containing program outcomes

Update a Program

Update a Program

POST /program/:uuid
{
    "name": "program",
    "description": "program",
    "concept": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "retired": false,
    "outcomesConcept": "5c938680-c300-4fc0-9a72-e798220f287b"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"name\": \"program\",\n    \"description\": \"program\",\n    \"concept\": \"116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\n    \"retired\": false,\n    \"outcomesConcept\": \"5c938680-c300-4fc0-9a72-e798220f287b\"\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/program/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"name": "program","description": "program","concept":"116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","retired": false,"outcomesConcept": "5c938680-c300-4fc0-9a72-e798220f287b"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/program/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a Program. This method only modifies properties specified in the request. Returns a 404 Not found. If not authenticated or authenticated user does not have sufficient privileges, 401 Unauthorized status is returned.

Properties

Parameter Type Description
name String Name of the program
description String Description of the program
retired Boolean Is program retired
concept Concept_UUID Concept resource UUID (Required)
outcomesConcept Concept_UUID Concept resource UUID containing program outcomes

Delete a Program

Delete a Program

DELETE /program/:uuid?purge=true
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/program/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/program/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete or retire a Program by its UUID. Returns a 404 Not Found status if patient not exists. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

Query Parameters

Parameter Type Description
uuid String Program's uuid to delete
purge Boolean The program will be retired unless purge = 'true'

Program Workflow

Program Workflow Overview

A program may be composed of one or more workflows. If there are no workflows, only the patient_program data (entry date, exit date, outcome) is maintained. Many programs have only one workflow, but some have more than one. For example, in the pregnancy program, there might be an "all patients" workflow, a "high risk" workflow, and a "delivery" workflow; a woman with a high risk pregnancy would get both the "all patients" protocol and the "high risk" protocol.

Subresource types

Program Workflow States

A workflow is composed of states, at most one of which will be assigned to a particular patient at a particular time; for example, an HIV program might have "registered", "ready for ARV", "on initial ARV regimen", "on other 1st line regimen", "on 2nd line regimen", "defaulted", "lost to follow-up", "died", etc. Some states are "initial" states, to which patient may be assigned upon entry into the program; other states are "terminal" states – when a patient is assigned to this state, the patient's participation in the program comes to an end.

Available Operations for Program Workflow type

  1. List Program Workflow by UUID
  2. Create a Program Workflow
  3. Update a Program Workflow
  4. Delete a Program Workflow
  5. List Program Workflow States
  6. Create Program Workflow State
  7. Update Program Workflow State
  8. Delete Program Workflow State

List Program Workflow by UUID

List Program Workflow by UUID

GET /workflow/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "uuid": "65fd8425-1090-4a24-8db6-c89aa80daa5d",
    "concept": {
        "uuid": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
        "display": "Malaria",
        "links": [
            {
                "rel": "self",
                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "resourceAlias": "concept"
            }
        ]
    },
    "description": null,
    "retired": false,
    "states": [
        {
            "uuid": "f0f0c506-a969-4a3b-84dc-d5d7057b9fcd",
            "description": null,
            "retired": false,
            "concept": {
                "uuid": "11034efc-1b2b-4cda-a414-74786a76b800",
                "display": "dead",
                "name": {
                    "display": "dead",
                    "uuid": "af75b2bd-5b7e-4e85-a70d-69da546047ed",
                    "name": "dead",
                    "locale": "en",
                    "localePreferred": true,
                    "conceptNameType": "FULLY_SPECIFIED",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800/name/af75b2bd-5b7e-4e85-a70d-69da546047ed",
                            "resourceAlias": "name"
                        },
                        {
                            "rel": "full",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800/name/af75b2bd-5b7e-4e85-a70d-69da546047ed?v=full",
                            "resourceAlias": "name"
                        }
                    ],
                    "resourceVersion": "1.9"
                },
                "datatype": {
                    "uuid": "8d4a48b6-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Coded",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptdatatype/8d4a48b6-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptdatatype"
                        }
                    ]
                },
                "conceptClass": {
                    "uuid": "8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Test",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptclass"
                        }
                    ]
                },
                "set": false,
                "version": null,
                "retired": false,
                "names": [
                    {
                        "uuid": "af75b2bd-5b7e-4e85-a70d-69da546047ed",
                        "display": "dead",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800/name/af75b2bd-5b7e-4e85-a70d-69da546047ed",
                                "resourceAlias": "name"
                            }
                        ]
                    }
                ],
                "descriptions": [],
                "mappings": [],
                "answers": [],
                "setMembers": [],
                "attributes": [],
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800",
                        "resourceAlias": "concept"
                    },
                    {
                        "rel": "full",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800?v=full",
                        "resourceAlias": "concept"
                    }
                ],
                "resourceVersion": "2.0"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/f0f0c506-a969-4a3b-84dc-d5d7057b9fcd",
                    "resourceAlias": "state"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/f0f0c506-a969-4a3b-84dc-d5d7057b9fcd?v=full",
                    "resourceAlias": "state"
                }
            ],
            "resourceVersion": "1.8"
        },
        {
            "uuid": "ce13f1c0-742a-415b-91ad-a0b1bd888bc8",
            "description": null,
            "retired": false,
            "concept": {
                "uuid": "51d62167-7642-489b-ad0a-79b3b8654882",
                "display": "cured",
                "name": {
                    "display": "cured",
                    "uuid": "dca5be41-93fa-48fb-a507-faabfd012891",
                    "name": "cured",
                    "locale": "en",
                    "localePreferred": true,
                    "conceptNameType": "FULLY_SPECIFIED",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882/name/dca5be41-93fa-48fb-a507-faabfd012891",
                            "resourceAlias": "name"
                        },
                        {
                            "rel": "full",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882/name/dca5be41-93fa-48fb-a507-faabfd012891?v=full",
                            "resourceAlias": "name"
                        }
                    ],
                    "resourceVersion": "1.9"
                },
                "datatype": {
                    "uuid": "8d4a48b6-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Coded",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptdatatype/8d4a48b6-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptdatatype"
                        }
                    ]
                },
                "conceptClass": {
                    "uuid": "8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Test",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptclass"
                        }
                    ]
                },
                "set": false,
                "version": null,
                "retired": false,
                "names": [
                    {
                        "uuid": "dca5be41-93fa-48fb-a507-faabfd012891",
                        "display": "cured",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882/name/dca5be41-93fa-48fb-a507-faabfd012891",
                                "resourceAlias": "name"
                            }
                        ]
                    }
                ],
                "descriptions": [],
                "mappings": [],
                "answers": [],
                "setMembers": [],
                "attributes": [],
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882",
                        "resourceAlias": "concept"
                    },
                    {
                        "rel": "full",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882?v=full",
                        "resourceAlias": "concept"
                    }
                ],
                "resourceVersion": "2.0"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/ce13f1c0-742a-415b-91ad-a0b1bd888bc8",
                    "resourceAlias": "state"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/ce13f1c0-742a-415b-91ad-a0b1bd888bc8?v=full",
                    "resourceAlias": "state"
                }
            ],
            "resourceVersion": "1.8"
        },
        {
            "uuid": "535c60a7-d349-4a36-97d0-898e938cdd6f",
            "description": null,
            "retired": false,
            "concept": {
                "uuid": "160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "display": "Malaria, confirmed",
                "name": {
                    "display": "Malaria, confirmed",
                    "uuid": "107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                    "name": "Malaria, confirmed",
                    "locale": "en",
                    "localePreferred": true,
                    "conceptNameType": "FULLY_SPECIFIED",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                            "resourceAlias": "name"
                        },
                        {
                            "rel": "full",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB?v=full",
                            "resourceAlias": "name"
                        }
                    ],
                    "resourceVersion": "1.9"
                },
                "datatype": {
                    "uuid": "8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "N/A",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptdatatype/8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptdatatype"
                        }
                    ]
                },
                "conceptClass": {
                    "uuid": "8d4918b0-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Diagnosis",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptclass/8d4918b0-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptclass"
                        }
                    ]
                },
                "set": false,
                "version": "",
                "retired": false,
                "names": [
                    {
                        "uuid": "126352BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "Malaria confirmées",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/126352BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "name"
                            }
                        ]
                    },
                    {
                        "uuid": "107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "Malaria, confirmed",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "name"
                            }
                        ]
                    }
                ],
                "descriptions": [],
                "mappings": [
                    {
                        "uuid": "242519ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "IMO ProblemIT: 1527785",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/242519ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "285752ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "ICPC2: A73",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/285752ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "217284ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "CIEL: 160148",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/217284ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "143841ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "PIH: 7127",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/143841ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "170552ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "SNOMED NP: 61462000",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/170552ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "143842ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "ICD-10-WHO: B53.8",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/143842ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "170553ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "SNOMED NP: 2931005",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/170553ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    }
                ],
                "answers": [],
                "setMembers": [],
                "attributes": [],
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                        "resourceAlias": "concept"
                    },
                    {
                        "rel": "full",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?v=full",
                        "resourceAlias": "concept"
                    }
                ],
                "resourceVersion": "2.0"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/535c60a7-d349-4a36-97d0-898e938cdd6f",
                    "resourceAlias": "state"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/535c60a7-d349-4a36-97d0-898e938cdd6f?v=full",
                    "resourceAlias": "state"
                }
            ],
            "resourceVersion": "1.8"
        }
    ],
    "links": [
        {
            "rel": "self",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d",
            "resourceAlias": "workflow"
        },
        {
            "rel": "full",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d?v=full",
            "resourceAlias": "workflow"
        }
    ],
    "resourceVersion": "1.8"
}

Fetch Program Workflow by UUID. Return a 404 Not Found status if given workflow doesn't exist. If user is not logged in to perform this action, a 401 Unauthorized status is returned.

Create a Program Workflow

Create a Program Workflow

POST /workflow
{
    "program": "959dc77c-7c2a-4f0d-9c4e-3a8f48c488e2",
    "concept": "112992AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"program\": \"959dc77c-7c2a-4f0d-9c4e-3a8f48c488e2\",\"concept\": \"112992AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"program": "959dc77c-7c2a-4f0d-9c4e-3a8f48c488e2","concept": "112992AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To create a workflow you need to specify the below properties in the request body. 401 Unauthorized is returned if the request is not authenticated or if the authenticated user does not have appropriate permissions.

Attributes

Parameter Type Description
program Program_UUID UUID of the parent program
concept Concept_UUID UUID of Concept related to the workflow

Update a Program Workflow

Update a Program Workflow

POST /workflow/:uuid
{
    "program": "959dc77c-7c2a-4f0d-9c4e-3a8f48c488e2",
    "concept": "112992AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"program\": \"959dc77c-7c2a-4f0d-9c4e-3a8f48c488e2\",\"concept\": \"112992AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"program": "959dc77c-7c2a-4f0d-9c4e-3a8f48c488e2","concept": "112992AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"});

var requestOptions = {
    method: 'POST',
    headers: requestHeaders,
    body: raw,
    redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow/:uuid", requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log('error', error));

To update a workflow you need to specify the below properties in the request body. 401 Unauthorized is returned if the request is not authenticated or if the authenticated user does not have appropriate permissions.

Attributes

Parameter Type Description
program Program_UUID UUID of the parent program
concept Concept_UUID UUID of Concept related to the workflow

Delete a Program Workflow

Delete a Program Workflow

DELETE /workflow/:uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow/:uuid")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retire given Workflow. Returns a 404 Not Found status if workflow does not exist. If not authenticated or authenticated user does not have sufficient privileges, 401 Unauthorized status is returned.

List Program Workflow States

List Program Workflow States

GET /workflow/:uuid/state
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow/:uuid/state")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow/:uuid/state", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "ce13f1c0-742a-415b-91ad-a0b1bd888bc8",
            "description": null,
            "retired": false,
            "concept": {
                "uuid": "51d62167-7642-489b-ad0a-79b3b8654882",
                "display": "cured",
                "name": {
                    "display": "cured",
                    "uuid": "dca5be41-93fa-48fb-a507-faabfd012891",
                    "name": "cured",
                    "locale": "en",
                    "localePreferred": true,
                    "conceptNameType": "FULLY_SPECIFIED",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882/name/dca5be41-93fa-48fb-a507-faabfd012891",
                            "resourceAlias": "name"
                        },
                        {
                            "rel": "full",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882/name/dca5be41-93fa-48fb-a507-faabfd012891?v=full",
                            "resourceAlias": "name"
                        }
                    ],
                    "resourceVersion": "1.9"
                },
                "datatype": {
                    "uuid": "8d4a48b6-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Coded",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptdatatype/8d4a48b6-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptdatatype"
                        }
                    ]
                },
                "conceptClass": {
                    "uuid": "8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Test",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptclass"
                        }
                    ]
                },
                "set": false,
                "version": null,
                "retired": false,
                "names": [
                    {
                        "uuid": "dca5be41-93fa-48fb-a507-faabfd012891",
                        "display": "cured",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882/name/dca5be41-93fa-48fb-a507-faabfd012891",
                                "resourceAlias": "name"
                            }
                        ]
                    }
                ],
                "descriptions": [],
                "mappings": [],
                "answers": [],
                "setMembers": [],
                "attributes": [],
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882",
                        "resourceAlias": "concept"
                    },
                    {
                        "rel": "full",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/51d62167-7642-489b-ad0a-79b3b8654882?v=full",
                        "resourceAlias": "concept"
                    }
                ],
                "resourceVersion": "2.0"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/ce13f1c0-742a-415b-91ad-a0b1bd888bc8",
                    "resourceAlias": "state"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/ce13f1c0-742a-415b-91ad-a0b1bd888bc8?v=full",
                    "resourceAlias": "state"
                }
            ],
            "resourceVersion": "1.8"
        },
        {
            "uuid": "f0f0c506-a969-4a3b-84dc-d5d7057b9fcd",
            "description": null,
            "retired": false,
            "concept": {
                "uuid": "11034efc-1b2b-4cda-a414-74786a76b800",
                "display": "dead",
                "name": {
                    "display": "dead",
                    "uuid": "af75b2bd-5b7e-4e85-a70d-69da546047ed",
                    "name": "dead",
                    "locale": "en",
                    "localePreferred": true,
                    "conceptNameType": "FULLY_SPECIFIED",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800/name/af75b2bd-5b7e-4e85-a70d-69da546047ed",
                            "resourceAlias": "name"
                        },
                        {
                            "rel": "full",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800/name/af75b2bd-5b7e-4e85-a70d-69da546047ed?v=full",
                            "resourceAlias": "name"
                        }
                    ],
                    "resourceVersion": "1.9"
                },
                "datatype": {
                    "uuid": "8d4a48b6-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Coded",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptdatatype/8d4a48b6-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptdatatype"
                        }
                    ]
                },
                "conceptClass": {
                    "uuid": "8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Test",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptclass"
                        }
                    ]
                },
                "set": false,
                "version": null,
                "retired": false,
                "names": [
                    {
                        "uuid": "af75b2bd-5b7e-4e85-a70d-69da546047ed",
                        "display": "dead",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800/name/af75b2bd-5b7e-4e85-a70d-69da546047ed",
                                "resourceAlias": "name"
                            }
                        ]
                    }
                ],
                "descriptions": [],
                "mappings": [],
                "answers": [],
                "setMembers": [],
                "attributes": [],
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800",
                        "resourceAlias": "concept"
                    },
                    {
                        "rel": "full",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/11034efc-1b2b-4cda-a414-74786a76b800?v=full",
                        "resourceAlias": "concept"
                    }
                ],
                "resourceVersion": "2.0"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/f0f0c506-a969-4a3b-84dc-d5d7057b9fcd",
                    "resourceAlias": "state"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/f0f0c506-a969-4a3b-84dc-d5d7057b9fcd?v=full",
                    "resourceAlias": "state"
                }
            ],
            "resourceVersion": "1.8"
        },
        {
            "uuid": "535c60a7-d349-4a36-97d0-898e938cdd6f",
            "description": null,
            "retired": false,
            "concept": {
                "uuid": "160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "display": "Malaria, confirmed",
                "name": {
                    "display": "Malaria, confirmed",
                    "uuid": "107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                    "name": "Malaria, confirmed",
                    "locale": "en",
                    "localePreferred": true,
                    "conceptNameType": "FULLY_SPECIFIED",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                            "resourceAlias": "name"
                        },
                        {
                            "rel": "full",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB?v=full",
                            "resourceAlias": "name"
                        }
                    ],
                    "resourceVersion": "1.9"
                },
                "datatype": {
                    "uuid": "8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "N/A",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptdatatype/8d4a4c94-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptdatatype"
                        }
                    ]
                },
                "conceptClass": {
                    "uuid": "8d4918b0-c2cc-11de-8d13-0010c6dffd0f",
                    "display": "Diagnosis",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptclass/8d4918b0-c2cc-11de-8d13-0010c6dffd0f",
                            "resourceAlias": "conceptclass"
                        }
                    ]
                },
                "set": false,
                "version": "",
                "retired": false,
                "names": [
                    {
                        "uuid": "126352BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "Malaria confirmées",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/126352BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "name"
                            }
                        ]
                    },
                    {
                        "uuid": "107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "Malaria, confirmed",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/107966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "name"
                            }
                        ]
                    }
                ],
                "descriptions": [],
                "mappings": [
                    {
                        "uuid": "242519ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "IMO ProblemIT: 1527785",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/242519ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "285752ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "ICPC2: A73",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/285752ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "217284ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "CIEL: 160148",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/217284ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "143841ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "PIH: 7127",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/143841ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "170552ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "SNOMED NP: 61462000",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/170552ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "143842ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "ICD-10-WHO: B53.8",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/143842ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    },
                    {
                        "uuid": "170553ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                        "display": "SNOMED NP: 2931005",
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/mapping/170553ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                "resourceAlias": "mapping"
                            }
                        ]
                    }
                ],
                "answers": [],
                "setMembers": [],
                "attributes": [],
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                        "resourceAlias": "concept"
                    },
                    {
                        "rel": "full",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA?v=full",
                        "resourceAlias": "concept"
                    }
                ],
                "resourceVersion": "2.0"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/535c60a7-d349-4a36-97d0-898e938cdd6f",
                    "resourceAlias": "state"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/65fd8425-1090-4a24-8db6-c89aa80daa5d/state/535c60a7-d349-4a36-97d0-898e938cdd6f?v=full",
                    "resourceAlias": "state"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

List all workflow states for given Program Workflow object. Returns 404 Not Found status if the workflow does not exist. If not authenticated or authenticated user does not have sufficient privileges, a 401 Unauthorized status is returned.

List Program Workflow States by UUID

List Program Workflow States by UUID

GET /workflow/:uuid/state/:state_uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow/:uuid/state/:state_uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow/:uuid/state/:state_uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List Program Workflow State by its UUID and UUID of its Program Workflow. Returns 404 Not Found status if the state does not exist. If not authenticated or authenticated user does not have sufficient privileges, a 401 Unauthorized status is returned.

Create Program Workflow State

Create Program Workflow State

POST /workflow/:uuid/state
{
    "concept": "7737c9ef-80ad-44e6-920f-4106da899df4",
    "initial": true,
    "terminal": false
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"concept\": \"7737c9ef-80ad-44e6-920f-4106da899df4\",\"initial\": true,\"terminal\": false}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow/:uuid/state")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"concept": "7737c9ef-80ad-44e6-920f-4106da899df4","initial": true,"terminal": false});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow/:uuid/state", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To create a Program Workflow State you need to specify below properties in your request body. If user not logged in to perform this action, a 401 Unauthorized status is returned.

### Attributes

Parameter Type Description
concept Concept_UUID UUID of related Concept
initial Boolean is initial state if true
terminal Boolean is terminal state if true

Update Program Workflow State

Update Program Workflow State

POST /workflow/:uuid/state/:state_uuid
{
    "concept": "7737c9ef-80ad-44e6-920f-4106da899df4",
    "initial": true,
    "terminal": false
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"concept\": \"7737c9ef-80ad-44e6-920f-4106da899df4\",\"initial\": true,\"terminal\": false}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow/:uuid/state/:state_uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"concept": "7737c9ef-80ad-44e6-920f-4106da899df4","initial": true,"terminal": false});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow/:uuid/state/:state_uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To update a Program Workflow State by its UUID you need to specify below properties in your request body. Returns a 404 Not Found status if given state doesn't exist. If user not logged in to perform this action, a 401 Unauthorized status is returned.

### Attributes

Parameter Type Description
concept Concept_UUID UUID of related Concept
initial Boolean is initial state if true
terminal Boolean is terminal state if true

Delete Program Workflow State

Delete Program Workflow State

DELETE /workflow/:uuid/state/:state_uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/workflow/:uuid/state/:state_uuid")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/workflow/:uuid/state/:state_uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Deletes given by UUID Program Workflow State. Returns a 404 Not Found status if given state doesn't exist. If user not logged in to perform this action, a 401 Unauthorized status is returned.

Program Enrollment

Program Enrollment Overview

A program enrollment represents the fact that a patient is enrolled in one of the Programs over a time period at a Location. This is longitudinal data with a start date and end date.

Available Operations for Program Enrollment type

  1. List Program Enrollment by UUID
  2. List Program Enrollments by Patient
  3. Update Program Enrollment Patient State

List Program Enrollment by UUID

List Program Enrollment by UUID

GET /programenrollment/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/programenrollment/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/programenrollment/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "uuid": "19ff2ee8-691f-4c4c-a0af-644a0d4198a7",
    "patient": {
        "uuid": "c5149f66-2695-102d-b4c2-001d929acb54",
        "display": "NNO 110 CCC - Jen George Henry",
        "links": [
            {
                "rel": "self",
                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/patient/c5149f66-2695-102d-b4c2-001d929acb54"
            }
        ]
    },
    "program": {
        "uuid": "acbd87f3-566f-4386-a11e-877e612d3911",
        "name": "Palliative care program",
        "allWorkflows": [
            {
                "uuid": "F2D47AE5-7083-4901-B630-51860D09A884",
                "concept": {
                    "uuid": "e7a7c2ca-7433-4851-8687-67e8541ca40b",
                    "display": "Palliative Care Treatment Status",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/e7a7c2ca-7433-4851-8687-67e8541ca40b"
                        }
                    ]
                },
                "retired": false,
                "states": [
                    {
                        "uuid": "e92017b9-45cf-41b9-bc69-a5b0232544c1",
                        "retired": false,
                        "concept": {
                            "uuid": "655b604e-977f-11e1-8993-905e29aff6c1",
                            "display": "Patient transferred out",
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/655b604e-977f-11e1-8993-905e29aff6c1"
                                }
                            ]
                        },
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884/state/e92017b9-45cf-41b9-bc69-a5b0232544c1"
                            }
                        ]
                    },
                    {
                        "uuid": "7c1f852e-5120-4371-8136-f64614f5dfc7",
                        "retired": false,
                        "concept": {
                            "uuid": "65664784-977f-11e1-8993-905e29aff6c1",
                            "display": "On treatment",
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/65664784-977f-11e1-8993-905e29aff6c1"
                                }
                            ]
                        },
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884/state/7c1f852e-5120-4371-8136-f64614f5dfc7"
                            }
                        ]
                    },
                    {
                        "uuid": "4bed1c08-1fe9-4972-8e7e-e93323c9f2c4",
                        "retired": false,
                        "concept": {
                            "uuid": "655b5e46-977f-11e1-8993-905e29aff6c1",
                            "display": "Patient died",
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/655b5e46-977f-11e1-8993-905e29aff6c1"
                                }
                            ]
                        },
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884/state/4bed1c08-1fe9-4972-8e7e-e93323c9f2c4"
                            }
                        ]
                    },
                    {
                        "uuid": "0f034ef4-3f70-4514-a020-5fb928fc3394",
                        "retired": false,
                        "concept": {
                            "uuid": "655b5f4a-977f-11e1-8993-905e29aff6c1",
                            "display": "Patient defaulted",
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/655b5f4a-977f-11e1-8993-905e29aff6c1"
                                }
                            ]
                        },
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884/state/0f034ef4-3f70-4514-a020-5fb928fc3394"
                            }
                        ]
                    },
                    {
                        "uuid": "13490dc8-e5bd-11e7-80c1-9a214cf093ae",
                        "retired": false,
                        "concept": {
                            "uuid": "6566dba4-977f-11e1-8993-905e29aff6c1",
                            "display": "Discharged",
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/6566dba4-977f-11e1-8993-905e29aff6c1"
                                }
                            ]
                        },
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884/state/13490dc8-e5bd-11e7-80c1-9a214cf093ae"
                            }
                        ]
                    },
                    {
                        "uuid": "b35ed57c-7d54-4795-b678-f0947a135fda",
                        "retired": false,
                        "concept": {
                            "uuid": "655a6acc-977f-11e1-8993-905e29aff6c1",
                            "display": "Treatment stopped",
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/655a6acc-977f-11e1-8993-905e29aff6c1"
                                }
                            ]
                        },
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884/state/b35ed57c-7d54-4795-b678-f0947a135fda"
                            }
                        ]
                    }
                ],
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884"
                    }
                ]
            }
        ],
        "links": [
            {
                "rel": "self",
                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/program/acbd87f3-566f-4386-a11e-877e612d3911"
            }
        ]
    },
    "display": "Palliative care program",
    "dateEnrolled": "2021-01-19T00:00:00.000+0000",
    "dateCompleted": "2021-09-01T00:00:00.000+0000",
    "location": {
        "uuid": "0d414ce2-5ab4-11e0-870c-9f6107fee88e",
        "display": "Neno District Hospital",
        "links": [
            {
                "rel": "self",
                "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/location/0d414ce2-5ab4-11e0-870c-9f6107fee88e"
            }
        ]
    },
    "voided": false,
    "outcome": null,
    "states": [
        {
            "state": {
                "uuid": "7c1f852e-5120-4371-8136-f64614f5dfc7",
                "retired": false,
                "concept": {
                    "uuid": "65664784-977f-11e1-8993-905e29aff6c1",
                    "display": "On treatment",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/65664784-977f-11e1-8993-905e29aff6c1"
                        }
                    ]
                },
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884/state/7c1f852e-5120-4371-8136-f64614f5dfc7"
                    }
                ]
            },
            "uuid": "fe0b3ca4-0d34-4b28-b686-49ec49dc6e1f",
            "startDate": "2021-01-19T00:00:00.000+0000",
            "endDate": "2021-09-01T00:00:00.000+0000",
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/programenrollment/19ff2ee8-691f-4c4c-a0af-644a0d4198a7/state/fe0b3ca4-0d34-4b28-b686-49ec49dc6e1f"
                }
            ]
        },
        {
            "state": {
                "uuid": "b35ed57c-7d54-4795-b678-f0947a135fda",
                "retired": false,
                "concept": {
                    "uuid": "655a6acc-977f-11e1-8993-905e29aff6c1",
                    "display": "Treatment stopped",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/concept/655a6acc-977f-11e1-8993-905e29aff6c1"
                        }
                    ]
                },
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/workflow/F2D47AE5-7083-4901-B630-51860D09A884/state/b35ed57c-7d54-4795-b678-f0947a135fda"
                    }
                ]
            },
            "uuid": "c44546a6-611b-4231-8a65-4e9d570580cd",
            "startDate": "2021-09-01T00:00:00.000+0000",
            "endDate": "2021-09-01T00:00:00.000+0000",
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/programenrollment/19ff2ee8-691f-4c4c-a0af-644a0d4198a7/state/c44546a6-611b-4231-8a65-4e9d570580cd"
                }
            ]
        }
    ],
    "attributes": [],
    "links": [
        {
            "rel": "self",
            "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/programenrollment/19ff2ee8-691f-4c4c-a0af-644a0d4198a7"
        },
        {
            "rel": "full",
            "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/programenrollment/19ff2ee8-691f-4c4c-a0af-644a0d4198a7?v=full"
        }
    ],
    "resourceVersion": "1.8"
}

Fetch Program Enrollment by UUID. Return a 404 Not Found status if given program enrollment doesn't exist. If user is not logged in to perform this action, a 401 Unauthorized status is returned.

List Program Enrollments by Patient

List Program Enrollments by Patient

GET /programenrollment?patient=:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/programenrollment?patient=:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/programenrollment?patient=:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "08044a4d-f323-45ad-98fd-9b421bbf36b6",
            "display": "CHRONIC CARE PROGRAM",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/programenrollment/08044a4d-f323-45ad-98fd-9b421bbf36b6"
                }
            ]
        },
        {
            "uuid": "9a507e64-1520-4441-ba04-49ed63ea9e07",
            "display": "MENTAL HEALTH CARE PROGRAM",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/programenrollment/9a507e64-1520-4441-ba04-49ed63ea9e07"
                }
            ]
        },
        {
            "uuid": "19ff2ee8-691f-4c4c-a0af-644a0d4198a7",
            "display": "Palliative care program",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://bwenzi.pih-emr.org:8081/openmrs/ws/rest/v1/programenrollment/19ff2ee8-691f-4c4c-a0af-644a0d4198a7"
                }
            ]
        }
    ]
}

Fetch Program Enrollment by Patient. Returns a 200 OK status. If Patient does not exist or has no program enrollments then it returns an empty results array. If user is not logged in to perform this action, a 401 Unauthorized status is returned.

Update Program Enrollment Patient State

Update Program Enrollment Patient State

POST /programenrollment/:uuid
{
    "states":[{
        "state":"b35ed57c-7d54-4795-b678-f0947a135fda",
        "startDate":"2021-09-01"
        }]
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"states\":[{\"state\":\"b35ed57c-7d54-4795-b678-f0947a135fda\",\"startDate\":\"2021-09-01\"}]}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/programenrollment/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");

var raw = JSON.stringify({"states":[{"state":"b35ed57c-7d54-4795-b678-f0947a135fda","startDate":"2021-09-01"}]});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/programenrollment/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To update a Program Enrollment Patient State by its UUID you need to specify below properties in your request body. Returns a 404 Not Found status if given state doesn't exist. If user not logged in to perform this action, a 401 Unauthorized status is returned.

### Attributes

Parameter Type Description
states Array[]: Program Workflow States List with of one Program Workflow State

Concept State Conversion

Available Operations for Concept State Conversion type

  1. List Concept State Conversions
  2. Create a Concept State Conversion
  3. Update a Concept State Conversion
  4. Delete a Concept State Conversion

List Concept State Conversions

List Concept State Conversions

GET /conceptstateconversion
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstateconversion")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");
var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstateconversion", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "ddf056be-40dd-44db-a95b-85bddd931131",
            "concept": {
                "uuid": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "display": "Malaria",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                        "resourceAlias": "concept"
                    }
                ]
            },
            "programWorkflow": {
                "uuid": "54524222-f41d-4d0d-b688-0fd5331377b4",
                "concept": {
                    "uuid": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                    "display": "Malaria",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                            "resourceAlias": "concept"
                        }
                    ]
                },
                "retired": false,
                "states": [
                    {
                        "uuid": "8d250876-baac-4592-8f87-d7d7bf00dcdb",
                        "retired": false,
                        "concept": {
                            "uuid": "7737c9ef-80ad-44e6-920f-4106da899df4",
                            "display": "malaria dead",
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/7737c9ef-80ad-44e6-920f-4106da899df4",
                                    "resourceAlias": "concept"
                                }
                            ]
                        },
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/54524222-f41d-4d0d-b688-0fd5331377b4/state/8d250876-baac-4592-8f87-d7d7bf00dcdb",
                                "resourceAlias": "state"
                            }
                        ]
                    },
                    {
                        "uuid": "65b552f7-a768-4986-b00c-28f765625450",
                        "retired": false,
                        "concept": {
                            "uuid": "160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                            "display": "Malaria, confirmed",
                            "links": [
                                {
                                    "rel": "self",
                                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                                    "resourceAlias": "concept"
                                }
                            ]
                        },
                        "links": [
                            {
                                "rel": "self",
                                "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/54524222-f41d-4d0d-b688-0fd5331377b4/state/65b552f7-a768-4986-b00c-28f765625450",
                                "resourceAlias": "state"
                            }
                        ]
                    }
                ],
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/54524222-f41d-4d0d-b688-0fd5331377b4",
                        "resourceAlias": "workflow"
                    }
                ]
            },
            "programWorkflowState": {
                "uuid": "65b552f7-a768-4986-b00c-28f765625450",
                "retired": false,
                "concept": {
                    "uuid": "160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                    "display": "Malaria, confirmed",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/160148AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                            "resourceAlias": "concept"
                        }
                    ]
                },
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://localhost:8080/openmrs/ws/rest/v1/workflow/54524222-f41d-4d0d-b688-0fd5331377b4/state/65b552f7-a768-4986-b00c-28f765625450",
                        "resourceAlias": "state"
                    }
                ]
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstateconversion/ddf056be-40dd-44db-a95b-85bddd931131",
                    "resourceAlias": "stateconversion"
                },
                {
                    "rel": "full",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/conceptstateconversion/ddf056be-40dd-44db-a95b-85bddd931131?v=full",
                    "resourceAlias": "stateconversion"
                }
            ]
        }
    ]
}

Fetch all Concept State Conversions. Returns a 200 OK status with the Concept State Conversions response. If user not logged in to perform this action, a 401 Unauthorized status is returned.

List Concept State Conversion by UUID.

List Concept State Conversion by UUID

GET /conceptstateconversion/:uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstateconversion/:uuid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");
var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstateconversion/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retrieve a Concept State Conversion by its UUID. Returns a 404 Not Found status if conversion does not exist. If user not logged in to perform this action, a 401 Unauthorized status is returned.

Create a Concept State Conversion

Create a Concept State Conversion

POST /conceptstateconversion
{
    "concept": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "programWorkflow": "54524222-f41d-4d0d-b688-0fd5331377b4",
    "programWorkflowState": "65b552f7-a768-4986-b00c-28f765625450"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"concept\": \"116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\"programWorkflow\": \"54524222-f41d-4d0d-b688-0fd5331377b4\",\"programWorkflowState\": \"65b552f7-a768-4986-b00c-28f765625450\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstateconversion")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");
var raw = JSON.stringify({"concept": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","programWorkflow": "54524222-f41d-4d0d-b688-0fd5331377b4","programWorkflowState": "65b552f7-a768-4986-b00c-28f765625450"});
var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstateconversion", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

To create a Concept State Conversion you need to specify the below properties in the request body. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Properties

Parameter Type Description
concept Concept_UUID Concept resource UUID
programWorkflow ProgramWorkflow_UUID ProgramWorkflow resource UUID
programWorkflowState ProgramWorkflowState_UUID ProgramWorkflowState resource UUID

Update a Concept State Conversion

Update a Concept State Conversion

POST /conceptstateconversion/:uuid
{
    "concept": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
    "programWorkflow": "54524222-f41d-4d0d-b688-0fd5331377b4",
    "programWorkflowState": "65b552f7-a768-4986-b00c-28f765625450"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"concept\": \"116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\"programWorkflow\": \"54524222-f41d-4d0d-b688-0fd5331377b4\",\"programWorkflowState\": \"65b552f7-a768-4986-b00c-28f765625450\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstateconversion/:uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ED9DBD5CFD355A973EFFECD642D8331D");
var raw = JSON.stringify({"concept": "116128AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","programWorkflow": "54524222-f41d-4d0d-b688-0fd5331377b4","programWorkflowState": "65b552f7-a768-4986-b00c-28f765625450"});
var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstateconversion/:uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update a Concept State Conversion. This method only modifies properties specified in the request. Returns a 404 Not Found status if conversion does not exist. If not authenticated or authenticated user does not have sufficient privileges, 401 Unauthorized status is returned.

Properties

Parameter Type Description
concept Concept_UUID Concept resource UUID
programWorkflow ProgramWorkflow_UUID ProgramWorkflow resource UUID
programWorkflowState ProgramWorkflowState_UUID ProgramWorkflowState resource UUID

Delete a Concept State Conversion

Delete a Concept State Conversion

DELETE /conceptstateconversion/:uuid?purge=true
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/conceptstateconversion/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=24D0761924138ED7E55C2CB6806B0633");
var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/conceptstateconversion/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Purge a Concept State Conversion by its UUID. Returns a 404 Not Found status if conversion does not exists. If the user is not logged in to perform this action, a 401 Unauthorized status returned.

Providers

Provider Overview

Sub Resource types of Provider

Provider Attribute.

Available operations for Provider.

  1. List providers
  2. Create a provider
  3. Update a provider
  4. Delete a provider
  5. List provider attribute sub resource
  6. Create provider attribute sub resource with properties
  7. Update provider attribute sub resource
  8. Delete provider attribute sub resource

List providers

GET /provider?q=clerk&v=default

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider?q=clerk&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=83604888EAFD9CEC35D0D67CB4C80D28")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=83604888EAFD9CEC35D0D67CB4C80D28");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider?q=clerk&v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "f36c6f95-f157-4803-ad99-eb0bf8d05454",
            "display": "clerk - John Smith",
            "person": {
                "uuid": "007037a0-0500-11e3-8ffd-0800200c9a66",
                "display": "John Smith",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/person/007037a0-0500-11e3-8ffd-0800200c9a66"
                    }
                ]
            },
            "identifier": "clerk",
            "attributes": [],
            "retired": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/provider/f36c6f95-f157-4803-ad99-eb0bf8d05454"
                },
                {
                    "rel": "full",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/provider/f36c6f95-f157-4803-ad99-eb0bf8d05454?v=full"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Get provider by name
includeAll Boolean If true, returns also retired Providers

Query provider by UUID.

GET /provider/:target_provider_uuid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider/f36c6f95-f157-4803-ad99-eb0bf8d05454")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=83604888EAFD9CEC35D0D67CB4C80D28")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=83604888EAFD9CEC35D0D67CB4C80D28");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/f36c6f95-f157-4803-ad99-eb0bf8d05454", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a provider

POST /provider
{
  "person": "007037a0-0500-11e3-8ffd-0800200c9a66",
  "identifier": "doctor",
  "attributes": [
    {
      "attributeType": "12efe9f5-c460-40f1-b776-3a61669549e4",
      "value": "unknown location"
    }
  ],
  "retired": false
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"person\": \"007037a0-0500-11e3-8ffd-0800200c9a66\",\r\n  \"identifier\": \"doctor\",\r\n  \"attributes\": [\r\n    {\r\n      \"attributeType\": \"12efe9f5-c460-40f1-b776-3a61669549e4\",\r\n      \"value\": \"unknown\"\r\n    }\r\n  ],\r\n  \"retired\": false\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var raw = JSON.stringify({"person":"007037a0-0500-11e3-8ffd-0800200c9a66","identifier":"doctor","attributes":[{"attributeType":"12efe9f5-c460-40f1-b776-3a61669549e4","value":"unknown"}],"retired":false});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider", requestOptions)


Update a provider

POST /provider/:target_provider_uuid
{
  "identifier": "Nurse"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"identifier\": \"Nurse\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider/7eec62f6-2b93-471e-a232-e0c9ed49f735")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var raw = JSON.stringify({"identifier":"Nurse"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/7eec62f6-2b93-471e-a232-e0c9ed49f735", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete a provider

DELETE /provider/:target_provider_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider/7eec62f6-2b93-471e-a232-e0c9ed49f735?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/7eec62f6-2b93-471e-a232-e0c9ed49f735?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

List provider attribute subresources

List provider attribute subresources by it's UUID and parent provider UUID.

GET /provider/:target_provider_uuid/attribute 

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


{
    "results": [
        {
            "display": "Provider Location: Unknown location",
            "uuid": "85db9ede-8866-41fe-bd01-62ccf9530516",
            "attributeType": {
                "uuid": "cff22d83-27e6-4195-8398-229853c1283f",
                "display": "Provider Location",
                "links": [
                    {
                        "rel": "self",
                        "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/providerattributetype/cff22d83-27e6-4195-8398-229853c1283f"
                    }
                ]
            },
            "value": "Unknown location",
            "voided": false,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute/85db9ede-8866-41fe-bd01-62ccf9530516"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute/85db9ede-8866-41fe-bd01-62ccf9530516?v=full"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

GET /provider/:target_provider_uuid/attribute/:target_provider_attribute_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute/85db9ede-8866-41fe-bd01-62ccf9530516")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute/85db9ede-8866-41fe-bd01-62ccf9530516", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a provider attribute sub resource with properties

POST provider/:target_provider_uuid/attribute 
{
  "attributeType": "cff22d83-27e6-4195-8398-229853c1283f",
  "value": "Unknown location"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"attributeType\": \"cff22d83-27e6-4195-8398-229853c1283f\",\r\n  \"value\": \"Unknown location\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var raw = JSON.stringify({"attributeType":"cff22d83-27e6-4195-8398-229853c1283f","value":"Unknown location"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute", requestOptions)
  .then(response => response.text())


Update provider attribute subresource

POST provider/:target_provider_uuid/attribute/:target_provider_attribute_uuid
{
    "value": "Inpatient Ward"
}

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var raw = JSON.stringify({"value":"Unknown location"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute/85db9ede-8866-41fe-bd01-62ccf9530516", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var raw = JSON.stringify({"value":"Unknown location"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute/85db9ede-8866-41fe-bd01-62ccf9530516", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
attributeType Attribute_Type UUID Create Attribute from this Attribute_Type
value Depends on Attribute_Type Selected Value for the attribute

Delete provider attribute subresource

DELETE /provider/:target_provider_uuid/attribute/:target_provider_attribute_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute/85db9ede-8866-41fe-bd01-62ccf9530516")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=269840E88294F9C726CE86E71A579DE3");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66/attribute/85db9ede-8866-41fe-bd01-62ccf9530516", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Provider Attribute Type

Provider Attribute Overview

Available operations for Provider Attribute type.

  1. List provider attribute types
  2. Create a provider attribute type
  3. Update a provider attribute type
  4. Delete a provider attribute type

List provider attribute types

List provider attribute types

GET /providerattributetype?q=Location&v=full

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/providerattributetype?q=Location&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=02524DC1695063DAFFC0E2B0FA3087A5")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=02524DC1695063DAFFC0E2B0FA3087A5");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/providerattributetype?q=Location&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "02b23eb5-d3d1-416d-b5c7-565acb6bc0cb",
            "display": "Provider Location",
            "name": "Provider Location",
            "description": "This attribute type will record the loication of the provider",
            "minOccurs": 0,
            "maxOccurs": 1,
            "datatypeClassname": "org.openmrs.customdatatype.datatype.LongFreeTextDatatype",
            "datatypeConfig": "default",
            "preferredHandlerClassname": "org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler",
            "handlerConfig": null,
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
                    "display": "admin",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002"
                        }
                    ]
                },
                "dateCreated": "2020-11-05T20:31:46.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/providerattributetype/02b23eb5-d3d1-416d-b5c7-565acb6bc0cb"
                }
            ],
            "resourceVersion": "1.9"
        }
    ]
}

Query Parameters

Parameter Type Description
q Search Query Display Name of provider attribute type.

List provider attribute type by UUID

List provider attribute type by UUID

GET /providerattributetype/:target_provider_attribute_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/providerattributetype/02b23eb5-d3d1-416d-b5c7-565acb6bc0cb")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=02524DC1695063DAFFC0E2B0FA3087A5")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=02524DC1695063DAFFC0E2B0FA3087A5");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/providerattributetype/02b23eb5-d3d1-416d-b5c7-565acb6bc0cb", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a provider attribute type

Create a provider attribute type

POST /providerattributetype
{
  "name": "Provider Location",
  "description": "This attribute type will record the location of the provider",
  "datatypeClassname": "org.openmrs.customdatatype.datatype.FreeTextDatatype",
  "minOccurs": 0,
  "maxOccurs": 1,
  "datatypeConfig": "default"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Provider Location\",\r\n  \"description\": \"This attribute type will record the location of the provider\",\r\n  \"datatypeClassname\": \"org.openmrs.customdatatype.datatype.FreeTextDatatype\",\r\n  \"minOccurs\": 0,\r\n  \"maxOccurs\": 1,\r\n  \"datatypeConfig\": \"default\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/providerattributetype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=644F0C130F7EA78D917F896CE811FBAF");

var raw = JSON.stringify({"name":"Provider Location","description":"This attribute type will record the location of the provider","datatypeClassname":"org.openmrs.customdatatype.datatype.FreeTextDatatype","minOccurs":0,"maxOccurs":1,"datatypeConfig":"default"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/providerattributetype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the provider attribute type (Required)
description String Description (Required)
datatypeClassname CustomDataType Resource Data type for the attribute type resource. OpenMRS provides Custom data type resource which gives flexibility to select the data type accordingly (Required)
minOccurs Number Minimum number of times this value can be specified for a single provider. Use 0 or 1 as the default value (Required)
maxOccurs Number Maximum number of times this value can be specified for a single provider (e.g., use 1 to prevent an attribute from being added to a provider multiple times)
preferredHandlerClassname Handler Specifies the Java class to be used when handling this provider attribute type. The java class must implement CustomDataTypeHandler. If not specified, the system will try to choose the best handler for the chosen datatype.
datatypeConfig String Provides ability to define custom data types configuration for OpenMRS
handlerConfig String Allow handler to be used for more than one attribute type. The actual configuration depends on the needs of the specified handler. For example, a "Pre-defined List" handler could be made to implement a simple selection list, and this configuration would tell the handler the possible choices in the list for this specific attribute type

Update a provider attribute type

Update a provider attribute type

POST /providerattributetype/:target_provider_attribute_type_uuid
{
  "name": "Provider Location Attribute",
  "minOccurs": 0,
  "maxOccurs": 2
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"name\": \"Provider Location Attribute\",\r\n  \"minOccurs\": 0,\r\n  \"maxOccurs\": 2\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/providerattributetype/02b23eb5-d3d1-416d-b5c7-565acb6bc0cb")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=02524DC1695063DAFFC0E2B0FA3087A5")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=02524DC1695063DAFFC0E2B0FA3087A5");

var raw = JSON.stringify({"name":"Provider Location Attribute","minOccurs":0,"maxOccurs":2});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/providerattributetype/02b23eb5-d3d1-416d-b5c7-565acb6bc0cb", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the provider attribute type
description String Description
datatypeClassname CustomDataType Resource Data type for the attribute type resource. OpenMRS provides Custom data type resource which gives flexibility to select the data type accordingly (Required)
minOccurs Number Minimum number of times this value can be specified for a single provider. Use 0 or 1 as the default value (Required)
maxOccurs Number Maximum number of times this value can be specified for a single provider (e.g., use 1 to prevent an attribute from being added to a provider multiple times)
preferredHandlerClassname Handler Specifies the Java class to be used when handling this provider attribute type. The java class must implement CustomDataTypeHandler. If not specified, the system will try to choose the best handler for the chosen datatype.
datatypeConfig String Provides ability to define custom data types configuration for OpenMRS
handlerConfig String Allow handler to be used for more than one attribute type. The actual configuration depends on the needs of the specified handler. For example, a "Pre-defined List" handler could be made to implement a simple selection list, and this configuration would tell the handler the possible choices in the list for this specific attribute type

Delete a provider attribute type

Delete a provider attribute type

DELETE /providerattributetype/:target_provider_attribute_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/providerattributetype/02b23eb5-d3d1-416d-b5c7-565acb6bc0cb?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=02524DC1695063DAFFC0E2B0FA3087A5")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=02524DC1695063DAFFC0E2B0FA3087A5");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/providerattributetype/02b23eb5-d3d1-416d-b5c7-565acb6bc0cb?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Task

Available operations for Task

  1. List tasks
  2. Create a task
  3. Update a task
  4. Delete a task
  5. Modify state of tasks

List tasks

List tasks

GET /taskdefinition
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/taskdefinition
&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/taskdefinition", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "8c17b376-1a2b-11e1-a51a-00248140a5eb",
            "name": "Auto Close Visits Task",
            "description": "Stops all active visits that match the visit type(s) specified by the value of the global property 'visits.autoCloseVisitType'",
            "taskClass": "org.openmrs.scheduler.tasks.AutoCloseVisitsTask",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/taskdefinition/8c17b376-1a2b-11e1-a51a-00248140a5eb",
                    "resourceAlias": "taskdefinition"
                }
            ]
        },
        {
            "uuid": "eb9e447d-5ef9-4771-9e88-21916340b69c",
            "name": "Initialize Logic Rule Providers",
            "description": null,
            "taskClass": "org.openmrs.logic.task.InitializeLogicRuleProvidersTask",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/taskdefinition/eb9e447d-5ef9-4771-9e88-21916340b69c",
                    "resourceAlias": "taskdefinition"
                }
            ]
        },
        {
            "uuid": "0f49b674-f1d8-4b63-a4b3-d9422027e6af",
            "name": "Process HL7 Task",
            "description": null,
            "taskClass": "org.openmrs.scheduler.tasks.ProcessHL7InQueueTask",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/taskdefinition/0f49b674-f1d8-4b63-a4b3-d9422027e6af",
                    "resourceAlias": "taskdefinition"
                }
            ]
        }
    ]
}

You can add an q=registered parameter to return only tasks that are available to be scheduled. Otherwise will return all schedules tasks. If not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
q String If set to "registered", will return only tasks that are available to be scheduled

List task by name or id.

List task by name or id

GET /taskdefinition/:name_or_id

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/taskdefinition/:name_or_id")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=3EFCD2FD54D00BE8491DFFD43AA706DC")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=3EFCD2FD54D00BE8491DFFD43AA706DC");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/taskdefinition/:name_or_id", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Retrieve a Task by its Name or Id. Returns a 404 Not Found status if Task does not exist. If user not logged in to perform this action, a 401 Unauthorized status returned.

Create a task

Create a task

POST /taskdefinition
{
    "name": "task",
    "description": "description",
    "taskClass": "org.openmrs.scheduler.tasks.ProcessHL7InQueueTask",
    "startTime": "2021-06-30T19:14:14.000+0200",
    "repeatInterval": "5",
    "startOnStartup": true,
    "properties": {}
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\": \"task\",\"description\": \"description\",\"taskClass\": \"org.openmrs.scheduler.tasks.ProcessHL7InQueueTask\",\"startTime\": \"2021-06-30T19:14:14.000+0200\",\"repeatInterval\": \"5\",\"startOnStartup\": true,\"properties\": {}}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/taskdefinition")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"name": "task","description": "description","taskClass": "org.openmrs.scheduler.tasks.ProcessHL7InQueueTask","startTime": "2021-06-30T19:14:14.000+0200","repeatInterval": "5","startOnStartup": true,"properties": {}});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/taskdefinition", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

You can create a new task by providing the attributes below. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
name String Name of the task
description String Description of the task
taskClass String Name of task's class that implements Task interface
startTime Date Date when the task will first start
repeatInterval String Number of seconds that this task will repeatedly run after
properties Map<String,String> Map of custom task's properties

Update a Task

Update a Task

POST /taskdefinition/:name_or_id
{
    "name": "task",
    "description": "description",
    "taskClass": "org.openmrs.scheduler.tasks.ProcessHL7InQueueTask",
    "startTime": "2021-06-30T19:14:14.000+0200",
    "repeatInterval": "5",
    "startOnStartup": true,
    "properties": {}
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\": \"task\",\"description\": \"description\",\"taskClass\": \"org.openmrs.scheduler.tasks.ProcessHL7InQueueTask\",\"startTime\": \"2021-06-30T19:14:14.000+0200\",\"repeatInterval\": \"5\",\"startOnStartup\": true,\"properties\": {}}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/taskdefinition/:name_or_id")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"name": "task","description": "description","taskClass": "org.openmrs.scheduler.tasks.ProcessHL7InQueueTask","startTime": "2021-06-30T19:14:14.000+0200","repeatInterval": "5","startOnStartup": true,"properties": {}});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/taskdefinition/:name_or_id", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

You can update existing task by its id or name. To update one, you have to provide the attributes below. Returns a 404 Not Found status if Task does not exist. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
name String Name of the task
description String Description of the task
taskClass String Name of task's class that implements Task interface
startTime Date Date when the task will first start
repeatInterval String Number of seconds that this task will repeatedly run after
properties Map<String,String> Map of custom task's properties

Delete a Task

Delete a Task

DELETE /taskdefinition/:uuid?purge=true
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/taskdefinition/:uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=154692F02BBBC664825F3C4C224A474B")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/taskdefinition/:uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Deletes (purges) a Task by its name or id. Returns a 404 Not Found status if the task does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Voiding tasks is not supported.

Modify state of tasks

Modify state of tasks

POST /taskaction
{
    "action": "RESCHEDULETASK",
    "tasks": ["Auto Close Visits Task"]
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"action\": \"RESCHEDULETASK\",\"tasks\": [\"Auto Close Visits Task\"]}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/taskaction")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"action": "RESCHEDULETASK","tasks": ["Auto Close Visits Task"]});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/taskaction", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

You can execute the following actions on tasks:

If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
action String One of the following actions: [SCHEDULETASK, SHUTDOWNTASK, RESCHEDULETASK, RESCHEDULEALLTASKS, DELETE, RUNTASK]
tasks Array[]: String List of tasks' ids or names that will be involved in the action above. Not provided with RESCHEDULEALLTASKS action.

Observations

Observations Overview

Available operations for Observations.

  1. List observations
  2. Create an observation
  3. Update an observation
  4. Delete an observation

List all observations.

List all observations

GET /obs?patient=070f0120-0283-4858-885d-a20d967729cf&limit=1"

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/obs?patient=070f0120-0283-4858-885d-a20d967729cf&limit=1")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=FE2FBD1F287477C74C655E0D467BA389")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=FE2FBD1F287477C74C655E0D467BA389");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/obs?patient=070f0120-0283-4858-885d-a20d967729cf&limit=1", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "99a0c42b-d50e-4ae3-b826-d1959c737e74",
            "display": "Visit Diagnoses: Primary, Confirmed diagnosis, Disease of bone and joint",
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/obs/99a0c42b-d50e-4ae3-b826-d1959c737e74"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/obs?patient=070f0120-0283-4858-885d-a20d967729cf&limit=2&startIndex=2"
        }
    ]
}

Query Parameters

Parameter Type Description
patient target_patient_uuid patient resource UUID
encounter target_encounter_uuid encounter resource UUID
concept target_concept_uuid concept resource UUID (we can use this parameter only if patient UUID is specified for the query)

Query observations by UUID.

Query observations by UUID

GET /obs/:target_observation_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/obs/94616eb5-6a87-4b83-b1e2-2083b3f7a36b")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=FE2FBD1F287477C74C655E0D467BA389")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=FE2FBD1F287477C74C655E0D467BA389");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/obs/94616eb5-6a87-4b83-b1e2-2083b3f7a36b", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an observation

Create an observation

POST /obs 
{
  "person": "070f0120-0283-4858-885d-a20d967729cf",
  "concept": "5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
  "obsDatetime": "2019-11-14T07:37:31.000+0000",
  "value": 70
}

var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=56AEC369713B93BCB5B9BC7B34AA6E5F");

var raw = JSON.stringify({"person":"070f0120-0283-4858-885d-a20d967729cf","concept":"5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","obsDatetime":"2019-11-14T07:37:31.000+0000","value":70});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/obs", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"person\": \"070f0120-0283-4858-885d-a20d967729cf\",\r\n  \"concept\": \"5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\r\n  \"obsDatetime\": \"2019-11-14T07:37:31.000+0000\",\r\n  \"value\": 70\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/obs")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=56AEC369713B93BCB5B9BC7B34AA6E5F")
  .build();
Response response = client.newCall(request).execute();

Attributes

Parameter Type Description
person Person UUID The Person this Obs is acting on (Required)
obsDateTime String The type of obsDateTime is an "ISO 8601 timestamp" (Required)
concept concept UUID the coded value/name given to an obs when it is made (Required)
Location location UUID the location this Obs took place (was taken).
order String the order of an Obs.
encounter encounter UUID what obs are collected and grouped together into. An encounter is a visit.
accessionNumber String An identifier used by the fulfiller (e.g., the lab) to identify the specimen or requisition used to produce this observation.
groupMembers Array[]: Obs a list of Obs grouped under this Obs
comment String An option free text comment about the observation.
value String The value for the observation (e.g., the answer to a question or the result of a lab test) (Required)
status String PRELIMINARY, FINAL, AMENDED
valueCodedName Concept Name ConceptNames are the words or phrases used to express the idea of a Concept within a particular locale
interpretation String NORMAL, ABNORMAL, CRITICALLY_ABNORMAL, NEGATIVE, POSITIVE,CRITICALLY_LOW, LOW, HIGH, CRITICALLY_HIGH, VERY_SUSCEPTIBLE, SUSCEPTIBLE, INTERMEDIATE, RESISTANT, SIGNIFICANT_CHANGE_DOWN, SIGNIFICANT_CHANGE_UP, OFF_SCALE_LOW, OFF_SCALE_HIGH
voided Boolean true if the observation is voided

Update an observation

Update an observation

POST /obs/:uuid_of_obs_to_be_updated
{
  "value": 71
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"value\": 71\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/obs/727124cd-191e-4073-a619-d3169c228374")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=56AEC369713B93BCB5B9BC7B34AA6E5F")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=56AEC369713B93BCB5B9BC7B34AA6E5F");

var raw = JSON.stringify({"value":71});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/obs/727124cd-191e-4073-a619-d3169c228374", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
person Person UUID The Person this Obs is acting on
obsDateTime String The type of obsDateTime is an "ISO 8601 timestamp"
concept concept UUID the coded value/name given to an obs when it is made
Location location UUID the location this Obs took place (was taken).
order String the order of an Obs.
encounter encounter UUID what obs are collected and grouped together into. An encounter is a visit.
accessionNumber String An identifier used by the fulfiller (e.g., the lab) to identify the specimen or requisition used to produce this observation.
groupMembers Array[]: Obs a list of Obs grouped under this Obs
comment String An option free text comment about the observation.
value String The value for the observation (e.g., the answer to a question or the result of a lab test)
status String PRELIMINARY, FINAL, AMENDED
valueCodedName Concept Name ConceptNames are the words or phrases used to express the idea of a Concept within a particular locale
interpretation String NORMAL, ABNORMAL, CRITICALLY_ABNORMAL, NEGATIVE, POSITIVE,CRITICALLY_LOW, LOW, HIGH, CRITICALLY_HIGH, VERY_SUSCEPTIBLE, SUSCEPTIBLE, INTERMEDIATE, RESISTANT, SIGNIFICANT_CHANGE_DOWN, SIGNIFICANT_CHANGE_UP, OFF_SCALE_LOW, OFF_SCALE_HIGH
voided Boolean true if the observation is voided

Delete an observation

Delete an observation

DELETE /obs/:target_obs_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/obs/4b2412bd-b538-4038-81d4-d2af153082b6?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=4C54B3334747032502B326EB3362BA0D")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=4C54B3334747032502B326EB3362BA0D");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/obs/4b2412bd-b538-4038-81d4-d2af153082b6?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Order

Order Overview

An Order represents a request from a provider such as a lab test, procedure, referral, etc.

For example, a provider could order a Complete Blood Count laboratory panel for a patient.

An Order only records an intention, not whether or not the action is carried out. The results of an Order are typically recorded later as Observations.

Available operations for Order type.

  1. List orders
  2. Create an order
  3. Delete an order

List orders

List orders

GET /openmrs/ws/rest/v1/order?patient=96be32d2-9367-4d1d-a285-79a5e5db12b8&caresetting=INPATIENT


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/order?patient=96be32d2-9367-4d1d-a285-79a5e5db12b8&caresetting=INPATIENT&limit=1&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/order?patient=96be32d2-9367-4d1d-a285-79a5e5db12b8&caresetting=INPATIENT&limit=1&v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "8f9e24b4-0498-493c-b87c-ae1535551345",
            "orderNumber": "ORD-1",
            "accessionNumber": null,
            "patient": {
                "uuid": "96be32d2-9367-4d1d-a285-79a5e5db12b8",
                "display": "1000C6 - Elizabeth Johnson",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/patient/96be32d2-9367-4d1d-a285-79a5e5db12b8"
                    }
                ]
            },
            "concept": {
                "uuid": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "display": "Pulse",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/concept/5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
                    }
                ]
            },
            "action": "NEW",
            "careSetting": {
                "uuid": "c365e560-c3ec-11e3-9c1a-0800200c9a66",
                "display": "Inpatient",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/caresetting/c365e560-c3ec-11e3-9c1a-0800200c9a66"
                    }
                ]
            },
            "previousOrder": null,
            "dateActivated": "2018-10-16T12:08:43.000+0000",
            "scheduledDate": null,
            "dateStopped": null,
            "autoExpireDate": null,
            "encounter": {
                "uuid": "69f83020-caf2-4c9e-bca7-89b8e62b52e1",
                "display": "Vitals 08/10/2016",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/encounter/69f83020-caf2-4c9e-bca7-89b8e62b52e1"
                    }
                ]
            },
            "orderer": {
                "uuid": "f9badd80-ab76-11e2-9e96-0800200c9a66",
                "display": "UNKNOWN - Super User",
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/provider/f9badd80-ab76-11e2-9e96-0800200c9a66"
                    }
                ]
            },
            "orderReason": null,
            "orderReasonNonCoded": null,
            "orderType": {
                "uuid": "52a447d3-a64a-11e3-9aeb-50e549534c5e",
                "display": "Test Order",
                "name": "Test Order",
                "javaClassName": "org.openmrs.TestOrder",
                "retired": false,
                "description": "Order type for test orders",
                "conceptClasses": [],
                "parent": null,
                "links": [
                    {
                        "rel": "self",
                        "uri": "/openmrs/ws/rest/v1/ordertype/52a447d3-a64a-11e3-9aeb-50e549534c5e"
                    },
                    {
                        "rel": "full",
                        "uri": "/openmrs/ws/rest/v1/ordertype/52a447d3-a64a-11e3-9aeb-50e549534c5e?v=full"
                    }
                ],
                "resourceVersion": "1.10"
            },
            "urgency": "ROUTINE",
            "instructions": null,
            "commentToFulfiller": null,
            "display": "Pulse",
            "specimenSource": null,
            "laterality": null,
            "clinicalHistory": null,
            "frequency": null,
            "numberOfRepeats": null,
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/order/8f9e24b4-0498-493c-b87c-ae1535551345"
                },
                {
                    "rel": "full",
                    "uri": "/openmrs/ws/rest/v1/order/8f9e24b4-0498-493c-b87c-ae1535551345?v=full"
                }
            ],
            "type": "testorder",
            "resourceVersion": "1.10"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "/openmrs/ws/rest/v1/order?patient=96be32d2-9367-4d1d-a285-79a5e5db12b8&caresetting=INPATIENT&limit=1&v=default&startIndex=1"
        }
    ]
}

Query Parameters

Parameter Type Description
q String Full or partial display name of order
patient Patient UUID the patient for the order
concept Concept UUID UUID for the concept of the order; the item being requested (e.g., "serum creatinine") (Must be used with patient parameter not independently)
careSetting String various levels of care-setting, for e.g.INPATIENT,OUTPATIENT etc. (Must be used with patient parameter not independently)
orderType OrderType UUID the type of the order (Must be used with patient parameter not independently)

activatedOnOrBeforeDate | Date | the activation date of the order (Must be used with patient parameter not independently) activatedOnOrAfterDate | Date | the start date of the order (Must be used with patient parameter not independently)

Get a particular order

Get a particular order

GET /order/:target_order_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/order")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/order", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an order

Create an order

POST /order
{
  "type":"testorder",
  "action": "new",
  "urgency": "ROUTINE",
  "dateActivated": "2018-10-16 12:08:43",
  "careSetting": "INPATIENT" ,
  "encounter": "69f83020-caf2-4c9e-bca7-89b8e62b52e1",
  "patient": "96be32d2-9367-4d1d-a285-79a5e5db12b8",
  "concept": "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
  "orderer": "f9badd80-ab76-11e2-9e96-0800200c9a66"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"type\": \"testorder\",\r\n    \"action\": \"new\",\r\n    \"urgency\": \"ROUTINE\",\r\n    \"dateActivated\": \"2018-10-16 12:08:43\",\r\n    \"careSetting\": \"INPATIENT\",\r\n    \"encounter\": \"69f83020-caf2-4c9e-bca7-89b8e62b52e1\",\r\n    \"patient\": \"96be32d2-9367-4d1d-a285-79a5e5db12b8\",\r\n    \"concept\": \"5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\",\r\n    \"orderer\": \"f9badd80-ab76-11e2-9e96-0800200c9a66\"\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/order/")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=70434FCF03A8A6D351D3C9E97B7DF674")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var raw = JSON.stringify({"type":"testorder","action":"new","urgency":"ROUTINE","dateActivated":"2018-10-16 12:08:43","careSetting":"INPATIENT","encounter":"69f83020-caf2-4c9e-bca7-89b8e62b52e1","patient":"96be32d2-9367-4d1d-a285-79a5e5db12b8","concept":"5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","orderer":"f9badd80-ab76-11e2-9e96-0800200c9a66"});

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/order", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Delete an order

Delete an order

DELETE /order/:target_order_uuid?purge=true

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=70434FCF03A8A6D351D3C9E97B7DF674");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/order/8f9e24b4-0498-493c-b87c-ae1535551345?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));```

```java

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/order/8f9e24b4-0498-493c-b87c-ae1535551345?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=70434FCF03A8A6D351D3C9E97B7DF674")
  .build();
Response response = client.newCall(request).execute();

Order type

Order type Overview

Available operations for Order type.

  1. List orders
  2. Create an order
  3. Update an order
  4. Delete an order

List orders

List orders

GET /ordertype?v=full

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/ordertype?v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/ordertype?v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "131168f4-15f5-102d-96e4-000c29c2a5d7",
            "display": "Drug Order",
            "name": "Drug Order",
            "javaClassName": "org.openmrs.DrugOrder",
            "retired": false,
            "description": "An order for a medication to be given to the patient",
            "conceptClasses": [],
            "parent": null,
            "auditInfo": {
                "creator": {
                    "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
                    "display": "admin",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002"
                        }
                    ]
                },
                "dateCreated": "2010-05-12T00:00:00.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/ordertype/131168f4-15f5-102d-96e4-000c29c2a5d7"
                }
            ],
            "resourceVersion": "1.10"
        },
        {
            "uuid": "52a447d3-a64a-11e3-9aeb-50e549534c5e",
            "display": "Test Order",
            "name": "Test Order",
            "javaClassName": "org.openmrs.TestOrder",
            "retired": false,
            "description": "Order type for test orders",
            "conceptClasses": [],
            "parent": null,
            "auditInfo": {
                "creator": {
                    "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
                    "display": "admin",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002"
                        }
                    ]
                },
                "dateCreated": "2014-03-09T00:00:00.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/ordertype/52a447d3-a64a-11e3-9aeb-50e549534c5e"
                }
            ],
            "resourceVersion": "1.10"
        }
    ]
}

Get a particular order type

Get a particular order type

GET /ordertype/:target_ordertype_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/ordertype/131168f4-15f5-102d-96e4-000c29c2a5d7")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/ordertype/131168f4-15f5-102d-96e4-000c29c2a5d7", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an order type

Create an order type

POST /ordertype
{
    "name": "drug order3",
    "description": "One 500mg tablet of Ciprofloxacin, twice a day",
    "parent": "070f0120-0283-4858-885d-a20d967729cf",
    "javaClassName": "org.openmrs.DrugOrder"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"name\": \"drug order\",\r\n    \"description\": \"One 500mg tablet of Ciprofloxacin, twice a day\",\r\n    \"parent\": \"070f0120-0283-4858-885d-a20d967729cf\",\r\n    \"javaClassName\": \"org.openmrs.DrugOrder\"\r\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/ordertype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var raw = JSON.stringify({"name":"drug order","description":"One 500mg tablet of Ciprofloxacin, twice a day","parent":"070f0120-0283-4858-885d-a20d967729cf","javaClassName":"org.openmrs.DrugOrder"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/ordertype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String the name of the order type (Required)
description String the description of the order type
javaClassName Java Class the java class (Required)
parent Order UUID the order uuid
conceptClasses Array[] : Concept UUID classes of concepts that can be used to generate an order of this type.

Update an order type

Update an order type

POST /ordertype/:target_ordertype_uuid
{
  "description": "One 400mg tablet of Ciprofloxacin, twice a day"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"description\": \"One 400mg tablet of Ciprofloxacin, twice a day\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/ordertype/131168f4-15f5-102d-96e4-000c29c2a5d7")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var raw = JSON.stringify({"description":"One 400mg tablet of Ciprofloxacin, twice a day"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/ordertype/131168f4-15f5-102d-96e4-000c29c2a5d7", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));


Attributes

Parameter Type Description
name String the name of the order type
description String the description of the order type
javaClassName Java Class the java class
parent Order UUID the order uuid
conceptClasses Array[] : Concept UUID classes of concepts that can be used to generate an order of this type.

Delete an order type

Delete an order type

DELETE /ordertype/:target_ordertype_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/ordertype/131168f4-15f5-102d-96e4-000c29c2a5d7?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/ordertype/131168f4-15f5-102d-96e4-000c29c2a5d7?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Forms

Forms Overview

Subresource types of Forms

formFields

Available operations for Forms

  1. List Forms
  2. Create a form
  3. Update a form
  4. Delete a form
  5. List formfields
  6. Create formFields subresource with properties
  7. Update formFields subresource with properties
  8. Delete formFields subresource with properties

List Forms

search-forms

GET /form?

Fetch all non-retired Forms that match any specified parameters otherwise fetch all non-retired forms. Returns a 200 OK status with the form response, and returns a 401 response when the user is not logged in.

Query Parameters

Parameter Description
limit use this parameter to limit the number of results to be returned
startIndex the offset where to start the query
v the required representation to return (i.e., ref, default, full or custom )
q the search query

List forms by UUID

GET /form/:target_form_uuid

Retrieve a form by its UUID. Returns a 404 Not Found status if the form does not exist in the system. If the user is not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Description
v the required representation to return (i.e. ref, default, full or custom )
uuid the target form UUID

Create-a-form

POST /form
{
  "name": "Admission",
  "description": "dummy description",
  "version": "1.0",
  "encounterType": "Vitals",
  "published": true,
  "formFields": [
    "medication","allergies"
  ],
  "xslt": "xslt specification for this form",
  "template": "dummy template"
}

Update a form

POST /form/:target_form_uuid
{
  "name": "Admission",
  "description": "dummy description",
  "version": "1.0",
  "encounterType": "Vitals",
  "published": true,
  "formFields": [
    "medication","allergies"
  ],
  "xslt": "xslt specification for this form",
  "template": "dummy template"
}

Delete a form

DELETE /form/:target_form_uuid?purge=true

List formfields

List all formFields subresources for a form.

GET /form/:target_form_uuid/formfield

Retrieve all formFields subresources of a form resource by target_form_uuid. Returns a 404 Not Found status if formFields not exist. If the user is not logged in to perform this action, a 401 unauthorized status returned.

List formFields subresource by its UUID and parent form UUID.

GET /form/:target_form_uuid/formfield/:target_formFields_uuid

Retrieve a formFields subresources of a form resource. Returns a 404 Not Found status if formFields does not exist. If you are not logged in to perform this action, a 401 Unauthorized status returned.

create formfield subresource with properties

POST form/:target_form_uuid/formfield
{
  form: "UUID",
  field: "UUID",
  required: false,
  parent: "UUID",
  fieldNumber: 2,
  fieldPart: "4",
  pageNumber: 1,
  minOccurs: 0,
  maxOccurs: 1,
  sortWeight: false
}

Update formFields subresource with properties

POST form/:target_form_uuid/formfield/:target_formFields_uuid
{
  form: "UUID",
  field: "UUID",
  required: false,
  parent: "UUID",
  fieldNumber: 2,
  fieldPart: "4",
  pageNumber: 1,
  minOccurs: 0,
  maxOccurs: 1,
  sortWeight: false
}

Delete formFields subresource with properties

DELETE /form/:target_form_uuid/formfield/:target_formFields_uuid

Field Type

Field Type Overview

Available operations for field Type

  1. List field types
  2. Create an field type
  3. Update an field type
  4. Delete an field type

List field types

List field types

GET /fieldtype?

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/fieldtype?v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/fieldtype?v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "8d5e7d7c-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Concept",
            "name": "Concept",
            "description": "",
            "isSet": false,
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
                    "display": "admin",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002"
                        }
                    ]
                },
                "dateCreated": "2005-02-22T00:00:00.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/fieldtype/8d5e7d7c-c2cc-11de-8d13-0010c6dffd0f"
                }
            ],
            "resourceVersion": "1.8"
        },
        {
            "uuid": "8d5e8196-c2cc-11de-8d13-0010c6dffd0f",
            "display": "Database element",
            "name": "Database element",
            "description": "",
            "isSet": false,
            "retired": false,
            "auditInfo": {
                "creator": {
                    "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002",
                    "display": "admin",
                    "links": [
                        {
                            "rel": "self",
                            "uri": "/openmrs/ws/rest/v1/user/45ce6c2e-dd5a-11e6-9d9c-0242ac150002"
                        }
                    ]
                },
                "dateCreated": "2005-02-22T00:00:00.000+0000",
                "changedBy": null,
                "dateChanged": null
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "/openmrs/ws/rest/v1/fieldtype/8d5e8196-c2cc-11de-8d13-0010c6dffd0f"
                }
            ],
            "resourceVersion": "1.8"
        }
    ]
}

Query Parameters

Parameter Description
limit use this parameter to limit the number of results to be returned.
startIndex the offset where to start the query.
v the required representation to return (i.e., ref, default, full or custom ).
q the search query based on the name of the field type.

Get field type by UUID.

Get field type by UUID

GET /fieldtype/:target_field_type_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/fieldtype/8d5e86fa-c2cc-11de-8d13-0010c6dffd0f")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/fieldtype/8d5e86fa-c2cc-11de-8d13-0010c6dffd0f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create an field type

Create an field type

POST /fieldtype
{
    "name": "Concept",
    "description": "fields storing info related to concepts",
    "isSet": true
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\": \"Concept\",\"description\": \"fields storing info related to concepts\",\"isSet\": true}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/fieldtype")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var raw = JSON.stringify({"name": "Concept","description": "fields storing info related to concepts","isSet": true});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/fieldtype", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name for the field type (required)
description String Description for the field type (required)
isSet Boolean Is field type a set

Update an field type

Update an field type

POST /fieldtype/:target_field_type_uuid
{
    "name": "Concept",
    "description": "fields storing info related to concepts",
    "isSet": true
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\": \"Concept\",\"description\": \"fields storing info related to concepts\",\"isSet\": true}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/fieldtype/8d5e7d7c-c2cc-11de-8d13-0010c6dffd0f")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var raw = JSON.stringify({"name": "Concept","description": "fields storing info related to concepts","isSet": true});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/fieldtype/8d5e7d7c-c2cc-11de-8d13-0010c6dffd0f", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name for the field type
description String Description for the field type
isSet Boolean Is field type a set

Delete an field type

Delete an field type

DELETE /fieldtype/:target_field_type_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/fieldtype/8d5e7d7c-c2cc-11de-8d13-0010c6dffd0f?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0")
  .build();
Response response = client.newCall(request).execute();


var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=1FB1E7BA1F2EF800D4BDF81D1D1FB1F0");

var requestOptions = {
  method: 'DELETE',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/fieldtype/8d5e7d7c-c2cc-11de-8d13-0010c6dffd0f?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Address Template

Address Template Overview

Address Template is an XML Layout Template.

Available operations for Address Template

  1. Retrieve Address Template
  2. Update Address Template

Retrieve Address Template

Retrieve Address Template

GET /systemsetting/layout.address.format
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/systemsetting/layout.address.format")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");
var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/systemsetting/layout.address.format", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "uuid": "98fa7af1-d183-4f70-93fb-2f488000ce4c",
    "property": "layout.address.format",
    "value": "<org.openmrs.layout.address.AddressTemplate>\n     <nameMappings class=\"properties\">\n       <property name=\"postalCode\" value=\"Location.postalCode\"/>\n       <property name=\"address2\" value=\"Location.address2\"/>\n       <property name=\"address1\" value=\"Location.address1\"/>\n       <property name=\"country\" value=\"Location.country\"/>\n       <property name=\"stateProvince\" value=\"Location.stateProvince\"/>\n       <property name=\"cityVillage\" value=\"Location.cityVillage\"/>\n     </nameMappings>\n     <sizeMappings class=\"properties\">\n       <property name=\"postalCode\" value=\"10\"/>\n       <property name=\"address2\" value=\"40\"/>\n       <property name=\"address1\" value=\"40\"/>\n       <property name=\"country\" value=\"10\"/>\n       <property name=\"stateProvince\" value=\"10\"/>\n       <property name=\"cityVillage\" value=\"10\"/>\n     </sizeMappings>\n     <lineByLineFormat>\n       <string>address1</string>\n       <string>address2</string>\n       <string>cityVillage stateProvince country postalCode</string>\n     </lineByLineFormat>\n   </org.openmrs.layout.address.AddressTemplate>",
    "description": null,
    "display": "Layout - Address Format = <org.openmrs.layout.address.AddressTemplate>\n     <nameMappings class=\"properties\">\n       <property name=\"postalCode\" value=\"Location.postalCode\"/>\n       <property name=\"address2\" value=\"Location.address2\"/>\n       <property name=\"address1\" value=\"Location.address1\"/>\n       <property name=\"country\" value=\"Location.country\"/>\n       <property name=\"stateProvince\" value=\"Location.stateProvince\"/>\n       <property name=\"cityVillage\" value=\"Location.cityVillage\"/>\n     </nameMappings>\n     <sizeMappings class=\"properties\">\n       <property name=\"postalCode\" value=\"10\"/>\n       <property name=\"address2\" value=\"40\"/>\n       <property name=\"address1\" value=\"40\"/>\n       <property name=\"country\" value=\"10\"/>\n       <property name=\"stateProvince\" value=\"10\"/>\n       <property name=\"cityVillage\" value=\"10\"/>\n     </sizeMappings>\n     <lineByLineFormat>\n       <string>address1</string>\n       <string>address2</string>\n       <string>cityVillage stateProvince country postalCode</string>\n     </lineByLineFormat>\n   </org.openmrs.layout.address.AddressTemplate>",
    "links": [
        {
            "rel": "self",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/systemsetting/98fa7af1-d183-4f70-93fb-2f488000ce4c",
            "resourceAlias": "systemsetting"
        },
        {
            "rel": "full",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/systemsetting/98fa7af1-d183-4f70-93fb-2f488000ce4c?v=full",
            "resourceAlias": "systemsetting"
        }
    ],
    "resourceVersion": "1.9"
}

Retrieves current Address Template.

Update Address Template

Update Address Template

POST /systemsetting/layout.address.format
{
    "value": "<org.openmrs.layout.address.AddressTemplate>\n     <nameMappings class=\"properties\">\n       <property name=\"postalCode\" value=\"Location.postalCode\"/>\n       <property name=\"address2\" value=\"Location.address2\"/>\n       <property name=\"address1\" value=\"Location.address1\"/>\n       <property name=\"country\" value=\"Location.country\"/>\n       <property name=\"stateProvince\" value=\"Location.stateProvince\"/>\n       <property name=\"cityVillage\" value=\"Location.cityVillage\"/>\n     </nameMappings>\n     <sizeMappings class=\"properties\">\n       <property name=\"postalCode\" value=\"10\"/>\n       <property name=\"address2\" value=\"40\"/>\n       <property name=\"address1\" value=\"40\"/>\n       <property name=\"country\" value=\"10\"/>\n       <property name=\"stateProvince\" value=\"10\"/>\n       <property name=\"cityVillage\" value=\"10\"/>\n     </sizeMappings>\n     <lineByLineFormat>\n       <string>address1</string>\n       <string>address2</string>\n       <string>cityVillage stateProvince country postalCode</string>\n     </lineByLineFormat>\n   </org.openmrs.layout.address.AddressTemplate>"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"value\": \"<org.openmrs.layout.address.AddressTemplate>\\n     <nameMappings class=\\\"properties\\\">\\n       <property name=\\\"postalCode\\\" value=\\\"Location.postalCode\\\"/>\\n       <property name=\\\"address2\\\" value=\\\"Location.address2\\\"/>\\n       <property name=\\\"address1\\\" value=\\\"Location.address1\\\"/>\\n       <property name=\\\"country\\\" value=\\\"Location.country\\\"/>\\n       <property name=\\\"stateProvince\\\" value=\\\"Location.stateProvince\\\"/>\\n       <property name=\\\"cityVillage\\\" value=\\\"Location.cityVillage\\\"/>\\n     </nameMappings>\\n     <sizeMappings class=\\\"properties\\\">\\n       <property name=\\\"postalCode\\\" value=\\\"11\\\"/>\\n       <property name=\\\"address2\\\" value=\\\"40\\\"/>\\n       <property name=\\\"address1\\\" value=\\\"40\\\"/>\\n       <property name=\\\"country\\\" value=\\\"10\\\"/>\\n       <property name=\\\"stateProvince\\\" value=\\\"10\\\"/>\\n       <property name=\\\"cityVillage\\\" value=\\\"10\\\"/>\\n     </sizeMappings>\\n     <lineByLineFormat>\\n       <string>address1</string>\\n       <string>address2</string>\\n       <string>cityVillage stateProvince country postalCode</string>\\n     </lineByLineFormat>\\n   </org.openmrs.layout.address.AddressTemplate>\"\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/systemsetting/layout.address.format")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");
var raw = JSON.stringify({"value": "<org.openmrs.layout.address.AddressTemplate>\n     <nameMappings class=\"properties\">\n       <property name=\"postalCode\" value=\"Location.postalCode\"/>\n       <property name=\"address2\" value=\"Location.address2\"/>\n       <property name=\"address1\" value=\"Location.address1\"/>\n       <property name=\"country\" value=\"Location.country\"/>\n       <property name=\"stateProvince\" value=\"Location.stateProvince\"/>\n       <property name=\"cityVillage\" value=\"Location.cityVillage\"/>\n     </nameMappings>\n     <sizeMappings class=\"properties\">\n       <property name=\"postalCode\" value=\"11\"/>\n       <property name=\"address2\" value=\"40\"/>\n       <property name=\"address1\" value=\"40\"/>\n       <property name=\"country\" value=\"10\"/>\n       <property name=\"stateProvince\" value=\"10\"/>\n       <property name=\"cityVillage\" value=\"10\"/>\n     </sizeMappings>\n     <lineByLineFormat>\n       <string>address1</string>\n       <string>address2</string>\n       <string>cityVillage stateProvince country postalCode</string>\n     </lineByLineFormat>\n   </org.openmrs.layout.address.AddressTemplate>"});
var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};
fetch("/openmrs/ws/rest/v1/systemsetting/layout.address.format", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Updates current Address Template with new XML sent in field value.

Alert

Alert Overview

Alert is a notification that selected users receive on the main page of Legacy UI.

Available operations for Alert

  1. List alerts
  2. Create an alert
  3. Update an alert
  4. Delete an alert

List all alerts

Get all alerts

GET alert?v=default
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/alert?v=default
&v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/alert?v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
  "results": [
    {
      "uuid": "b4f9a6a0-2791-4106-ba94-28cb84d5aaae",
      "display": "There was an error starting the module: Reference Demo Data Module",
      "alertId": 6,
      "text": "There was an error starting the module: Reference Demo Data Module",
      "satisfiedByAny": true,
      "dateToExpire": "2021-06-15T00:00:00.000+0200",
      "alertRead": true,
      "recipients": [
        {
          "uuid": "c3e9fe79-9af1-4d6f-9113-5ded3db4582d",
          "display": "Super User (admin)",
          "links": [
            {
              "rel": "self",
              "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/b4f9a6a0-2791-4106-ba94-28cb84d5aaae/recipient/c3e9fe79-9af1-4d6f-9113-5ded3db4582d",
              "resourceAlias": "recipient"
            }
          ]
        }
      ],
      "links": [
        {
          "rel": "self",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/b4f9a6a0-2791-4106-ba94-28cb84d5aaae",
          "resourceAlias": "alert"
        },
        {
          "rel": "full",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/b4f9a6a0-2791-4106-ba94-28cb84d5aaae?v=full",
          "resourceAlias": "alert"
        }
      ],
      "resourceVersion": "1.8"
    },
    {
      "uuid": "bf40f1e9-16cb-452e-bf2c-0f9c0863d3e4",
      "display": "There was an error starting the module: Attachments",
      "alertId": 7,
      "text": "There was an error starting the module: Attachments",
      "satisfiedByAny": true,
      "dateToExpire": "2021-06-15T21:33:19.000+0200",
      "alertRead": true,
      "recipients": [
        {
          "uuid": "6dabf122-75f7-4dba-a12f-28ced570d922",
          "display": "Super User (admin)",
          "links": [
            {
              "rel": "self",
              "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/bf40f1e9-16cb-452e-bf2c-0f9c0863d3e4/recipient/6dabf122-75f7-4dba-a12f-28ced570d922",
              "resourceAlias": "recipient"
            }
          ]
        }
      ],
      "links": [
        {
          "rel": "self",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/bf40f1e9-16cb-452e-bf2c-0f9c0863d3e4",
          "resourceAlias": "alert"
        },
        {
          "rel": "full",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/bf40f1e9-16cb-452e-bf2c-0f9c0863d3e4?v=full",
          "resourceAlias": "alert"
        }
      ],
      "resourceVersion": "1.8"
    }
  ],
  "links": [
    {
      "rel": "next",
      "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert?v=default&startIndex=50",
      "resourceAlias": null
    }
  ]
}

You can add an includeExpired=true parameter to return also expired Alerts. If not logged in to perform this action, a 401 Unauthorized status is returned.

Query Parameters

Parameter Type Description
includeExpired Boolean Include expired alerts

Create an alert

Create an alert

{
    "text": "New alert",
    "satisfiedByAny": true,
    "dateToExpire": null,
    "recipients": [
        {
            "recipient": "c98a1558-e131-11de-babe-001e378eb67e"
        }
    ]
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"text\": \"New alert\",\"satisfiedByAny\": true,\"dateToExpire\": null,\"recipients\": [{\"recipient\": \"c98a1558-e131-11de-babe-001e378eb67e\"}]}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/alert")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"text": "New alert","satisfiedByAny": true,"dateToExpire": null,"recipients": [{"recipient": "c98a1558-e131-11de-babe-001e378eb67e"}]});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/alert", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

You can create a new alert with its recipients by using User's UUID as recipient's field value. If you are not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
text String Text of the alert
satisfiedByAny Boolean If true, this alert will be marked as read if only one of its recipients has read it
dateToExpire Date Date when the alert will become expired
recipients Array[] : recipient List of alert's recipients

Update an alert using its UUID

Update an alert

{
    "text": "Updated alert"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n    \"text\": \"Updated alert\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/alert/:alert_uuid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var raw = JSON.stringify({"text":"Updated alert"});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/alert/:alert_uuid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Update an alert with given UUID. Returns a 404 Not Found status if the alert does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Attributes

Parameter Type Description
text String Text of the alert
satisfiedByAny Boolean If true, this alert will be marked as read if only one of its recipients has read it
dateToExpire Date Date when the alert will become expired
recipients Array[] : recipient List of alert's recipients

Delete an alert

Delete an alert using its UUID

DELETE /alert/:alert_uuid?purge=true
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/alert/:alert_uuid?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=154692F02BBBC664825F3C4C224A474B")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/alert/:alert_uuid?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Deletes (purges) an alert by its UUID. Returns a 404 Not Found status if the user does not exist. If not logged in to perform this action, a 401 Unauthorized status is returned.

Voiding alerts is not supported.

Queue

Queue Overview

Available operations for Queues

  1. List queues
  2. Create queue
  3. Update queue
  4. Void queue

List queues

List queues

GET /

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queue)
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/queue, requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "4890b934-73c3-4c91-a93b-ce48f728b520",
            "display": "Clinical consultation",
            "name": "Clinical consultation",
            "description": "Clinical consultation",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/4890b934-73c3-4c91-a93b-ce48f728b520"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/4890b934-73c3-4c91-a93b-ce48f728b520?v=full"
                }
            ]
        },
        {
            "uuid": "ae0e1ad7-08ba-4a3d-aeed-a757591faf83",
            "display": "Triage service",
            "name": "Triage service",
            "description": "Triage service",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/ae0e1ad7-08ba-4a3d-aeed-a757591faf83"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/ae0e1ad7-08ba-4a3d-aeed-a757591faf83?v=full"
                }
            ]
        },
        {
            "uuid": "501b135b-1733-445e-9616-a4a05cee1bdd",
            "display": "Lab service",
            "name": "Lab service",
            "description": "Lab service",
            "links": [
                {
                    "rel": "self",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/501b135b-1733-445e-9616-a4a05cee1bdd"
                },
                {
                    "rel": "full",
                    "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/501b135b-1733-445e-9616-a4a05cee1bdd?v=full"
                }
            ]
        }
    ]
}

List queue by UUID

List queue by UUID

GET /queue/:target_queue_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queue/36475629-6652-44e9-a42b-c2b3b7438f72")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: "GET",
  headers: requestHeaders,
  redirect: "follow",
};

fetch(
  "/openmrs/ws/rest/v1/queue/36475629-6652-44e9-a42b-c2b3b7438f72",
  requestOptions
)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

Create queue

Create queue

POST /queue
{
  "name": "Triage queue",
  "description": "This triage queue description",
  "service": {
    "uuid": "d3db3805-2b90-4330-9064-eb6d42cbf582"
  },
  "location": {
    "uuid": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f"
  }
}

OkHttpClient client = new OkHttpClient().newBuilder()
 .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"name\": \"Triage queue\",\n  \"description\": \"This triage queue description\",\n  \"service\": {\n    \"uuid\": \"d3db3805-2b90-4330-9064-eb6d42cbf582\"\n  },\n  \"location\": {\n    \"uuid\": \"8d6c993e-c2cc-11de-8d13-0010c6dffd0f\"\n  }\n}");
Request request = new Request.Builder()
 .url("/openmrs/ws/rest/v1/queue")
 .method("POST", body)
 .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
 .addHeader("Content-Type", "application/json")
 .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
 .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({
  name: "Triage queue",
  description: "This triage queue description",
  service: {
    uuid: "d3db3805-2b90-4330-9064-eb6d42cbf582",
  },
  location: {
    uuid: "8d6c993e-c2cc-11de-8d13-0010c6dffd0f",
  },
});

var requestOptions = {
  method: "POST",
  headers: requestHeaders,
  body: raw,
  redirect: "follow",
};

fetch("/openmrs/ws/rest/v1/queue", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

Attributes

Parameter Type Description
name String Name of the queue
description String Description of the queue
service Concept_UUID Concept UUID describing this queue/service
location Location UUID Location resource UUID

Update queue

Update queue

POST /queue/:target_queue_uuid
{
  "name": "TRIAGE QUEUE (updated)",
  "description": "Queue for patients waiting for triage(updated)"
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"name\": \"TRIAGE QUEUE (updated)\",\n  \"description\": \"Queue for patients waiting for triage(updated)\"\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queue/c298d3e1-6def-422a-9d0a-e18906a4ae73")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({
  name: "TRIAGE QUEUE (updated)",
  description: "Queue for patients waiting for triage(updated)",
});

var requestOptions = {
  method: "POST",
  headers: requestHeaders,
  body: raw,
  redirect: "follow",
};

fetch(
  "/openmrs/ws/rest/v1/queue/c298d3e1-6def-422a-9d0a-e18906a4ae73",
  requestOptions
)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

Attributes

Parameter Type Description
UUID Queue UUID UUID of queue to be updated

Delete queue

Delete the target queue

DELETE /queue/<UUID>?purge=false

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queue/c298d3e1-6def-422a-9d0a-e18906a4ae73?purge=false")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: "DELETE",
  headers: requestHeaders,
  redirect: "follow",
};

fetch(
  "/openmrs/ws/rest/v1/queue/c298d3e1-6def-422a-9d0a-e18906a4ae73?purge=false",
  requestOptions
)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.log("error", error));

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided/retired unless purge = ‘true’
UUID Queue UUID Queue resource UUID

Queue Room

Queue Room Overview

Available operations for Queue Room

  1. List queue room
  2. Create queue room
  3. Update queue room
  4. Delete queue room
  5. Add provider to queue room

List queue room

List queue room

GET /queueroom

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queueroom?location=14bb1bfe-a095-11ed-a8fc-0242ac120002&queue=4890b934-73c3-4c91-a93b-ce48f728b520")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/queueroom?location=14bb1bfe-a095-11ed-a8fc-0242ac120002&queue=4890b934-73c3-4c91-a93b-ce48f728b520", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
  "results": [
    {
      "uuid": "6543436d-ba98-4f18-9207-7019dc6b3227",
      "display": "Room 1",
      "name": "Room 1",
      "description": "Room 1",
      "links": [
        {
          "rel": "self",
          "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queueroom/6543436d-ba98-4f18-9207-7019dc6b3227"
        },
        {
          "rel": "full",
          "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queueroom/6543436d-ba98-4f18-9207-7019dc6b3227?v=full"
        }
      ]
    },
    {
      "uuid": "7a552e16-f7f6-4558-9422-069cbc79ab19",
      "display": "Room 2",
      "name": "Room 2",
      "description": "Room 2",
      "links": [
        {
          "rel": "self",
          "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queueroom/7a552e16-f7f6-4558-9422-069cbc79ab19"
        },
        {
          "rel": "full",
          "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queueroom/7a552e16-f7f6-4558-9422-069cbc79ab19?v=full"
        }
      ]
    }
  ]
}

Query Parameters

Parameter Type Description
queue Queue UUID Get rooms for this queue (Required)
location Location UUID Get rooms for this location (Required)

List queue room by UUID

List queue room by UUID

GET /queueroom/:target_queue_room_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queueroom/7a552e16-f7f6-4558-9422-069cbc79ab19")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/queueroom/7a552e16-f7f6-4558-9422-069cbc79ab19", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create queue room

Create queue room

POST /queueroom
{
    "name": "Room 1",
    "description": "Room 1",
    "queue": {
        "uuid": "8764727d-cb3c-4af7-8ffa-ca32bc21f626"
    }
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"name\": \"Room 1\",\n    \"description\": \"Room 1\",\n    \"queue\": {\n        \"uuid\": \"8764727d-cb3c-4af7-8ffa-ca32bc21f626\"\n    }\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queueroom")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({
    "name": "Room 1",
    "description": "Room 1",
    "queue": {
        "uuid": "8764727d-cb3c-4af7-8ffa-ca32bc21f626"
    }
});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/queueroom", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the queue room (Required)
description String Description (Required)
queue Queue UUID Queue resource UUID (Required)

Update queue room

Update queue room

POST /queueroom/:target_queue_room_uuid
{
    "name": "Room 1 rename",
    "description": "Room 1",
    "queue": {
        "uuid": "73619fba-3f89-4a78-9188-5bd88fcb3e20"
    }
}

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"name\": \"Room 1\",\n    \"description\": \"Room 1\",\n    \"queue\": {\n        \"uuid\": \"8764727d-cb3c-4af7-8ffa-ca32bc21f626\"\n    }\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queueroom")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({
    "name": "Room 1",
    "description": "Room 1",
    "queue": {
        "uuid": "8764727d-cb3c-4af7-8ffa-ca32bc21f626"
    }
});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/queueroom", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
name String Name of the queue room
description String Description
queue Queue UUID Queue resource UUID

Delete queue room

Delete queue room

DELETE /queueroom/:target_queue_room_uuid?purge=false

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/queueroom/c298d3e1-6def-422a-9d0a-e18906a4ae73?purge=false")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/queueroom/c298d3e1-6def-422a-9d0a-e18906a4ae73?purge=false", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Add provider to queue room

Add provider to queue room

POST /roomprovidermap
{
    "queueRoom": {
        "uuid": "0dfa22b0-6b35-4594-8c3c-7589ad40ed44"
    },
    "provider": {
        "uuid": "7b0f5697-27e3-40c4-8bae-f4049abfb4ed"
    }
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"queueRoom\": {\n        \"uuid\": \"0dfa22b0-6b35-4594-8c3c-7589ad40ed44\"\n    },\n    \"provider\": {\n        \"uuid\": \"7b0f5697-27e3-40c4-8bae-f4049abfb4ed\"\n    }\n}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/roomprovidermap")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({
    "queueRoom": {
        "uuid": "0dfa22b0-6b35-4594-8c3c-7589ad40ed44"
    },
    "provider": {
        "uuid": "7b0f5697-27e3-40c4-8bae-f4049abfb4ed"
    }
});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/roomprovidermap", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
queueRoom Queue Room UUID Queue room resource UUID (Required)
provider Provider UUID Provider resource UUID (Required)

System Setting

System Setting Overview

Available operations for systemsetting type.

  1. List System Settings
  2. Create a System Setting
  3. Update a System Setting
  4. Delete a System Setting

List System Settings

List system settings

GET /systemsetting?limit=1&v=full

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/systemsetting?limit=1&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/systemsetting?limit=1&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "results": [
        {
            "uuid": "7ada585f-e2cc-456f-8fb2-67af52389293",
            "property": "addresshierarchy.addressToEntryMapUpdaterLastStartTime",
            "value": null,
            "description": "The module uses this field to store when the AddressToEntryMapUpdater task was last started; DO NOT MODIFY",
            "display": "Addresshierarchy - Address To Entry Map Updater Last Start Time = null",
            "datatypeClassname": null,
            "datatypeConfig": null,
            "preferredHandlerClassname": null,
            "handlerConfig": null,
            "links": [
                {
                    "rel": "self",
                    "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/systemsetting/7ada585f-e2cc-456f-8fb2-67af52389293"
                }
            ],
            "resourceVersion": "1.9"
        }
    ],
    "links": [
        {
            "rel": "next",
            "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/systemsetting?limit=1&v=full&startIndex=1"
        }
    ]
}

Query Parameters

Parameter Type Description
limit integer use this parameter to limit the number of results to be returned
startIndex integer the offset where to start the query
v String the required representation to return (i.e., ref, default, full or custom )
q String the search query

Get a particular System Setting

Get a particular system setting

GET /systemsetting/:target_systemsetting_uuid

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/systemsetting/addresshierarchy.allowFreetext")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/systemsetting/addresshierarchy.allowFreetext", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Create a System Setting

Create a system setting


POST /systemsetting
{
  "property": "property name",
  "description": "dummy description",
  "datatypeClassname": "org.openmrs.customdatatype.datatype.FreeTextDatatype",
  "datatypeConfig": "default",
  "preferredHandlerClassname":"org.openmrs.web.attribute.handler.FreeTextTextareaHandler",
  "handlerConfig": null,
  "value": "dummy value"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"property\": \"property name\",\r\n  \"description\": \"dummy description\",\r\n  \"datatypeClassname\": \"org.openmrs.customdatatype.datatype.FreeTextDatatype\",\r\n  \"datatypeConfig\": \"default\",\r\n  \"preferredHandlerClassname\":\"org.openmrs.web.attribute.handler.FreeTextTextareaHandler\",\r\n  \"handlerConfig\": null,\r\n  \"value\": \"dummy value\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/systemsetting/")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710");

var raw = JSON.stringify({"property":"property name","description":"dummy description","datatypeClassname":"org.openmrs.customdatatype.datatype.FreeTextDatatype","datatypeConfig":"default","preferredHandlerClassname":"org.openmrs.web.attribute.handler.FreeTextTextareaHandler","handlerConfig":null,"value":"dummy value"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/systemsetting/", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
property String the property name for this System Setting, names can be up to 255 chars, must be unique, and follow a convention of module ID followed by category & name lower camelCase separated by periods for e.g., addresshierarchy.allowFreetext.
description String a description for the usage of this property.
datatypeClassname String Data type for this System Setting.OpenMRS provides Custom data type resource, which gives flexibility to select the data type accordingly.
datatypeConfig String An optional identifier from the fulfiller e.g., lab
preferredHandlerClassname String Handler subresource for the Custom Data Type used. Can optionally define a specific handler class wants to use (otherwise, the framework will choose the best handler for the chosen DataType).
handlerConfig String Allow the handler have any name and config it wants/needs. This will help to identify the data type unambiguously which has been contained and will allow introspecting.
value String the value assigned to this system setting.

Update a System Setting

Updating system setting


POST /systemsetting/:target_systemsetting_uuid
{
  "property": "property name",
  "description": "dummy description",
  "datatypeClassname": "org.openmrs.customdatatype.datatype.FreeTextDatatype",
  "datatypeConfig": "default",
  "preferredHandlerClassname":"org.openmrs.web.attribute.handler.FreeTextTextareaHandler",
  "handlerConfig": null,
  "value": "dummy value"
}


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n  \"property\": \"property name\",\r\n  \"description\": \"dummy description\",\r\n  \"datatypeClassname\": \"org.openmrs.customdatatype.datatype.FreeTextDatatype\",\r\n  \"datatypeConfig\": \"default\",\r\n  \"preferredHandlerClassname\":\"org.openmrs.web.attribute.handler.FreeTextTextareaHandler\",\r\n  \"handlerConfig\": null,\r\n  \"value\": \"dummy value\"\r\n}\r\n");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/systemsetting/443b909a-82d7-4842-bf6a-f4e773ddcad8")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710");

var raw = JSON.stringify({"property":"property name","description":"dummy description","datatypeClassname":"org.openmrs.customdatatype.datatype.FreeTextDatatype","datatypeConfig":"default","preferredHandlerClassname":"org.openmrs.web.attribute.handler.FreeTextTextareaHandler","handlerConfig":null,"value":"dummy value"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/systemsetting/443b909a-82d7-4842-bf6a-f4e773ddcad8", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Attributes

Parameter Type Description
property String the property name for this System Setting, names can be up to 255 chars, must be unique, and follow a convention of module ID followed by category & name lower camelCase separated by periods for e.g., addresshierarchy.allowFreetext.
description String a description for the usage of this property.
datatypeClassname String Data type for this System Setting.OpenMRS provides Custom data type resource, which gives flexibility to select the data type accordingly.
datatypeConfig String An optional identifier from the fulfiller e.g., lab
preferredHandlerClassname String Handler subresource for the Custom Data Type used. Can optionally define a specific handler class wants to use (otherwise, the framework will choose the best handler for the chosen DataType).
handlerConfig String Allow the handler have any name and config it wants/needs. This will help to identify the data type unambiguously which has been contained and will allow introspecting.
value String the value assigned to this system setting.

Delete a System Setting

Delete a system setting

DELETE /systemsetting/:target_systemsetting_uuid?purge=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/systemsetting/7ada585f-e2cc-456f-8fb2-67af52389293?purge=true")
  .method("DELETE", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710");

var requestOptions = {
  method: 'DELETE',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/systemsetting/7ada585f-e2cc-456f-8fb2-67af52389293?purge=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Query Parameters

Parameter Type Description
purge Boolean The resource will be voided unless purge = ‘true’.Purging will attempt to remove the attribute type from the system irreversibly. Attribute types that have been used (i.e., are referenced from existing data) cannot be purged.

System Information

System Information Overview

Header Brief Description
1. OpenMRS Information This section holds information like OpenMRS Version Snapshot and other system wide informations like System Date and Time.
2. Java Runtime Environment Information This section has the relevant Java parameters along with the the operating system and its architecture information.For e.g. Operating System : Linux
3. Memory Information This section holds the total , free and the maximum heap Size memory information of the system.
4. Database Information This section has the relevant information about the database. For e.g. Database Schema name : openmrs-db
5. Module Information This section has the record of all the snapshot versions for each of the current modules. For e.g. Allergy UI Module : 1.8.3-SNAPSHOT

List System Inforamation

List system information


GET /systeminformation


OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/systeminformation")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/systeminformation", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
    "systemInfo": {
        "SystemInfo.title.openmrsInformation": {
            "SystemInfo.OpenMRSInstallation.systemDate": "2020-10-14",
            "SystemInfo.OpenMRSInstallation.systemTime": "20:05:43",
            "SystemInfo.OpenMRSInstallation.openmrsVersion": "2.3.0  Build b3ade0",
            "SystemInfo.hostname": "f945457f1f48"
        },
        "SystemInfo.title.javaRuntimeEnvironmentInformation": {
            "SystemInfo.JavaRuntimeEnv.operatingSystem": "Linux",
            "SystemInfo.JavaRuntimeEnv.operatingSystemArch": "amd64",
            "SystemInfo.JavaRuntimeEnv.operatingSystemVersion": "4.4.0-190-generic",
            "SystemInfo.JavaRuntimeEnv.javaVersion": "1.8.0_212",
            "SystemInfo.JavaRuntimeEnv.javaVendor": "Oracle Corporation",
            "SystemInfo.JavaRuntimeEnv.jvmVersion": "25.212-b01",
            "SystemInfo.JavaRuntimeEnv.jvmVendor": "Oracle Corporation",
            "SystemInfo.JavaRuntimeEnv.javaRuntimeName": "OpenJDK Runtime Environment",
            "SystemInfo.JavaRuntimeEnv.javaRuntimeVersion": "1.8.0_212-8u212-b01-1~deb9u1-b01",
            "SystemInfo.JavaRuntimeEnv.userName": "root",
            "SystemInfo.JavaRuntimeEnv.systemLanguage": "en",
            "SystemInfo.JavaRuntimeEnv.systemTimezone": "Etc/UTC",
            "SystemInfo.JavaRuntimeEnv.fileSystemEncoding": "UTF-8",
            "SystemInfo.JavaRuntimeEnv.userDirectory": "/usr/local/tomcat",
            "SystemInfo.JavaRuntimeEnv.tempDirectory": "/usr/local/tomcat/temp"
        },
        "SystemInfo.title.memoryInformation": {
            "SystemInfo.Memory.totalMemory": "607 MB",
            "SystemInfo.Memory.freeMemory": "350 MB",
            "SystemInfo.Memory.maximumHeapSize": "683 MB"
        },
        "SystemInfo.title.dataBaseInformation": {
            "SystemInfo.Database.name": "\"openmrs-db\"",
            "SystemInfo.Database.connectionURL": "jdbc:mysql://openmrs-referenceapplication-mysql:3306/\"openmrs-db\"?autoReconnect=true&sessionVariables=default_storage_engine=InnoDB&useUnicode=true&characterEncoding=UTF-8",
            "SystemInfo.Database.userName": "\"openmrs-user\"",
            "SystemInfo.Database.driver": null,
            "SystemInfo.Database.dialect": null
        },
        "SystemInfo.title.moduleInformation": {
            "SystemInfo.Module.repositoryPath": "/usr/local/tomcat/.OpenMRS/modules",
            "Atlas Module": "2.2 ",
            "Form Entry App Module": "1.4.2 ",
            "Reporting": "1.20.0 ",
            "Metadata Sharing": "1.6.0 ",
            "ID Generation": "4.5.0 ",
            "Allergy UI Module": "1.8.2 ",
            "EMR API Module": "1.28.0 ",
            "Registration App Module": "1.16.0 ",
            "HTML Form Entry UI Framework Integration Module": "1.10.0 ",
            "App Framework Module": "2.14.0 ",
            "Reporting REST": "1.11.0 ",
            "Reference Metadata Module": "2.10.2 ",
            "Metadata Mapping": "1.3.4 ",
            "Admin UI Module": "1.3.0 ",
            "OpenMRS UI Framework": "3.17.0 ",
            "Reference Application Module": "2.10.0 ",
            "Metadata Deploy": "1.11.0 ",
            "App UI Module": "1.12.0 ",
            "Reporting Compatibility": "2.0.6 ",
            "HTML Widgets": "1.10.0 ",
            "Serialization Xstream": "0.2.14 ",
            "Address Hierarchy": "2.11.0 ",
            "Registration Core Module": "1.9.0 ",
            "Attachments": "2.2.0 ",
            "Core Apps Module": "1.28.0 ",
            "Event Module": "2.7.0 ",
            "Provider Management Module": "2.10.0 ",
            "Calculation": "1.2 ",
            "Appointment Scheduling UI Module": "1.9.0 ",
            "Open Web Apps Module": "1.10.0 ",
            "HTML Form Entry": "3.10.0 ",
            "FHIR Module": "1.20.0 ",
            "UI Commons Module": "2.12.0 ",
            "Reporting UI Module": "1.6.0 ",
            "Appointment Scheduling Module": "1.12.0 ",
            "Rest Web Services OMOD": "2.28.0.df1459 ",
            "Legacy UI Module": "1.6.0 ",
            "Data Exchange Module": "1.3.4 ",
            "Reference Demo Data Module": "1.4.5 ",
            "UI Library Module": "2.0.6 "
        }
    }
}

Query Parameters

Parameter Type Description
limit integer use this parameter to limit the number of results to be returned
startIndex integer the offset where to start the query
v String the required representation to return (i.e., ref, default, full or custom )

Logged in Users

Logged in Users Overview

OpenMRS REST API allows you to query list of logged in usernames.

List Logged in Users

List Logged in Users

GET /loggedinusers
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/loggedinusers")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/loggedinusers", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

[
    "admin"
]

Search Index

Available operations for Search Index

  1. Update Search Index

Update Search Index

Update Search Index

POST /searchindexupdate
{
    "resource": "patient",
    "subResource": "patientidentifier",
    "uuid": "fd07779c-b8f1-4b90-b41b-45cf9bc538f8",
    "async": false
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"resource\": \"patient\",\"subResource\": \"patientidentifier\",\"uuid\": \"fd07779c-b8f1-4b90-b41b-45cf9bc538f8\",\"async\": false}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/searchindexupdate")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"resource": "patient","subResource": "patientidentifier","uuid": "fd07779c-b8f1-4b90-b41b-45cf9bc538f8","async": false});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/searchindexupdate", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Executes rebuild of search index.

You can execute one of three operations:

Attributes

Parameter Type Description
resource String Resource name of type that you want to regenerate index for
subResource String Resource name of subtype that you want to regenerate index for
uuid UUID UUID of object that you want to regenerate index for
async Boolean Should rebuilding index be executed asynchronously

Locale and Theme Configuration

Locale and Theme Configuration Overview

You can set default theme and default locale via REST API.

Available operations for Locale and Theme Configuration

  1. Retrieve Configuration
  2. Update Configuration

Retrieve Configuration

Retrieve Configuration

GET /localeandthemeconfiguration
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/localeandthemeconfiguration")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/localeandthemeconfiguration", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "defaultLocale": "en_GB",
    "defaultTheme": "green"
}

Retrieves current configuration.

Update Configuration

Update Configuration

POST /localeandthemeconfiguration
{
    "defaultLocale": "en_GB",
    "defaultTheme": "green"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"defaultLocale\": \"en_GB\",\"defaultTheme\": \"green\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/localeandthemeconfiguration")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"defaultLocale": "en_GB","defaultTheme": "green"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/localeandthemeconfiguration", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Updates current configuration with the following properties:

Attributes

Parameter Type Description
defaultLocale String Default Locale for OpenMRS instance. Has to be a valid language code. For example: en, en_GB, es
defaultTheme String Default Theme for OpenMRS instance. For example: "orange", "purple", "green", and "legacy"

Implementation Id Configuration

Available operations for Implementation Id Configuration

  1. Retrieve Configuration
  2. Update Configuration

Retrieve Configuration

Retrieve Configuration

GET /implementationid
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/implementationid")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/implementationid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "name": "name",
    "description": "recovering teest",
    "implementationId": "implementationId",
    "passphrase": "passphrase"
}

Retrieves current configuration.

Update Configuration

Update Configuration

POST /implementationid
{
    "name": "name",
    "description": "description",
    "implementationId": "implementationId",
    "passphrase": "passphrase"
}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"name\": \"name\",\"description\": \"description\",\"implementationId\": \"implementationId\",\"passphrase\": \"passphrase\"}");
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/implementationid")
  .method("POST", body)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Content-Type", "application/json")
  .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C")
  .build();
Response response = client.newCall(request).execute();
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Content-Type", "application/json");
requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C");

var raw = JSON.stringify({"name": "name","description": "description","implementationId": "implementationId","passphrase": "passphrase"});

var requestOptions = {
  method: 'POST',
  headers: requestHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/implementationid", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Updates current configuration with the following properties:

Attributes

Parameter Type Description
name String A descriptive name for this implementation (e.g. AMRS installation in Eldoret, Kenya)
description String Text describing this implementation. (e.g. Source for the AMPATH program in Kenya. Created by Paul Biondich)
implementationId String This is the unique id for this implementation. Used as the HL7_CODE. Must be limited to 20 characters and numbers. The characters "^" and "
passphrase String This text is a long text string that is used to validate who uses your implementation id. Multiple installations of openmrs can use the same implmentation id, but they must all know the passphrase. (Note that if an implementation id is shared, it is assumed that those installations are the same implementation).

Administration Links

Every installed module can register its administration pages. They are accessible through Legacy UI at openmrs/admin/index.htm

The following endpoints allow users to return list of installed modules with their administration links.

  1. List Administration Links

List Administration Links

GET /administrationlinks?v=default
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/administrationlinks?v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/administrationlinks?v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "results": [
        {
            "uuid": "webservices.rest",
            "display": "REST Web Services",
            "title": "REST Web Services",
            "administrationLinks": {
                "module/webservices/rest/settings.form": "Settings",
                "module/webservices/rest/test.htm": "Test",
                "module/webservices/rest/apiDocs.htm": "API Documentation"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/administrationlinks/webservices.rest",
                    "resourceAlias": "administrationlinks"
                }
            ]
        },
        {
            "uuid": "owa",
            "display": "Open Web Apps Module",
            "title": "Open Web Apps Module",
            "administrationLinks": {
                "/module/owa/manager.form": "Manage Apps",
                "/module/owa/settings.form": "Settings"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/administrationlinks/owa",
                    "resourceAlias": "administrationlinks"
                }
            ]
        },
        {
            "uuid": "openconceptlab",
            "display": "Open Concept Lab",
            "title": "Open Concept Lab",
            "administrationLinks": {
                "/owa/openconceptlab/index.html#/subscription": "Configuration Page",
                "/owa/openconceptlab/index.html#/": "Status Page"
            },
            "links": [
                {
                    "rel": "self",
                    "uri": "http://localhost:8080/openmrs/ws/rest/v1/administrationlinks/openconceptlab",
                    "resourceAlias": "administrationlinks"
                }
            ]
        }
    ]
}

List Administration Links by module ID

GET /administrationlinks/:moduleId
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/administrationlinks/:moduleId")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/administrationlinks/:moduleId", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "uuid": "webservices.rest",
    "display": "REST Web Services",
    "title": "REST Web Services",
    "administrationLinks": {
        "module/webservices/rest/settings.form": "Settings",
        "module/webservices/rest/test.htm": "Test",
        "module/webservices/rest/apiDocs.htm": "API Documentation"
    },
    "links": [
        {
            "rel": "self",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/administrationlinks/webservices.rest",
            "resourceAlias": "administrationlinks"
        }
    ],
    "resourceVersion": "1.8"
}

Database Changes

Database Changes Overview

Database Change is a Liquibase change set represented by OpenMRSChangeSet class.

Available Operations for Database Changes type

  1. List Database Changes

List Database Changes

List Database Changes

GET /databasechange?v=default
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/databasechange?v=default")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/databasechange?v=default", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
  "results": [
    {
      "uuid": "1227303685425-1",
      "display": "ben (generated) createTable tableName=cohort",
      "author": "ben (generated)",
      "description": "createTable tableName=cohort",
      "runStatus": "INVALID_MD5SUM",
      "links": [
        {
          "rel": "self",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-1",
          "resourceAlias": "databasechange"
        },
        {
          "rel": "full",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-1?v=full",
          "resourceAlias": "databasechange"
        }
      ],
      "resourceVersion": "1.8"
    },
    {
      "uuid": "1227303685425-2",
      "display": "ben (generated) createTable tableName=cohort_member",
      "author": "ben (generated)",
      "description": "createTable tableName=cohort_member",
      "runStatus": "ALREADY_RAN",
      "links": [
        {
          "rel": "self",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-2",
          "resourceAlias": "databasechange"
        },
        {
          "rel": "full",
          "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-2?v=full",
          "resourceAlias": "databasechange"
        }
      ],
      "resourceVersion": "1.8"
    }
  ],
  "links": [
    {
      "rel": "next",
      "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange?v=default&startIndex=50",
      "resourceAlias": null
    }
  ]
}

Fetches all liquibase change sets. Returns a 200 OK status with the List of DatabaseChange response.

Get Database Change by its Id

Get Database Change by its Id

GET /databasechange/:id
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/databasechange/:id")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44")
  .build();
Response response = client.newCall(request).execute();
var myHeaders = new Headers();
myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/databasechange/:id", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
    "uuid": "1227303685425-34",
    "display": "ben (generated) createTable tableName=hl7_in_error",
    "author": "ben (generated)",
    "description": "createTable tableName=hl7_in_error",
    "runStatus": "INVALID_MD5SUM",
    "links": [
        {
            "rel": "self",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-34",
            "resourceAlias": "databasechange"
        },
        {
            "rel": "full",
            "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-34?v=full",
            "resourceAlias": "databasechange"
        }
    ],
    "resourceVersion": "1.8"
}

Fetches Liquibase change set by its id. Returns a 404 Not Found status if the change set does not exist. If the user is not logged in to perform this action, a 401 Unauthorized status is returned.

EMRAPI Configuration

EMR API Configuration Overview

The EMR API module provides several high-level APIs and configuration settings. The configuration endpoint provided by the emrapi module enables RESTful access to these configuration values.

Available operations for EMRAPI Configuration

  1. Get EMRAPI Configuration

Get EMRAPI Configuration

Get EMRAPI configuration

GET /openmrs/ws/rest/v1/emrapi/configuration

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/emrapi/configuration")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();

var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/emrapi/configuration", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response

{
  "metadataSourceName": string,
  "orderingProviderEncounterRole": encounterRole,
  "supportsTransferLocationTag": locationTag,
  "unknownLocation": location,
  "denyAdmissionConcept": concept,
  "admissionForm": form,
  "exitFromInpatientEncounterType": encounterType,
  "extraPatientIdentifierTypes": patientIdentifierType[],
  "consultFreeTextCommentsConcept": concept,
  "sameAsConceptMapType": conceptMapType,
  "testPatientPersonAttributeType": personAttributeType,
  "admissionDecisionConcept": concept,
  "supportsAdmissionLocationTag": locationTag,
  "checkInEncounterType": encounterType,
  "transferWithinHospitalEncounterType": encounterType,
  "suppressedDiagnosisConcepts": concept[],
  "primaryIdentifierType": patientIdentifierType,
  "nonDiagnosisConceptSets": concept[],
  "fullPrivilegeLevel": role,
  "unknownProvider": provider,
  "diagnosisSets": concept[],
  "personImageDirectory": string,
  "visitNoteEncounterType": encounterType,
  "consultEncounterType": encounterType,
  "diagnosisMetadata": {
    "diagnosisCertaintyConcept": concept,
    "diagnosisOrderConcept": concept,
    "codedDiagnosisConcept": concept,
    "nonCodedDiagnosisConcept": concept,
    "diagnosisSetConcept": concept
  },
  "narrowerThanConceptMapType": conceptMapType,
  "clinicianEncounterRole": encounterRole,
  "conceptSourcesForDiagnosisSearch": conceptSource[],
  "patientDiedConcept": concept,
  "emrApiConceptSource": conceptSource,
  "lastViewedPatientSizeLimit": integer,
  "identifierTypesToSearch": patientIdentifierType[],
  "telephoneAttributeType": personAttributeType,
  "checkInClerkEncounterRole": encounterRole,
  "dischargeForm": form,
  "unknownCauseOfDeathConcept": concept,
  "visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary": boolean,
  "atFacilityVisitType": visitType,
  "visitExpireHours": integer,
  "admissionEncounterType": encounterType,
  "dispositions": [
    {
      "uuid": string,
      "name": string,
      "conceptCode": string,
      "type: string,
      "careSettingTypes": string[],
      "encounterTypes": string[],
      "excludedEncounterTypes": string[],
      "keepsVisitOpen": boolean,
      "actions": string[],
      "additionalObs": [
        {
          "label": string,
          "conceptCode: string,
          "params: map<string, string>
        }
      ],
    }
  ],
  "dispositionDescriptor": {
    "admissionLocationConcept": concept,
    "dateOfDeathConcept": concept,
    "dispositionConcept": concept,
    "internalTransferLocationConcept": concept,
    "dispositionSetConcept": concept
  },
  "highPrivilegeLevel": role,
  "supportsLoginLocationTag": locationTag,
  "unknownPatientPersonAttributeType": personAttributeType,
  "supportsVisitsLocationTag": locationTag,
  "transferForm": form
}

Supported Parameters:

The endpoint supports all standard representations (ref, default, full, and custom). If no representation is specified, the ref is returned.
For any given representation, all properties are returned with the given representation.
A custom representation can be used to retrieve only specific properties of interest, and specific data within those representations.

Inpatient Admission

Overview

Provides a means to retrieve inpatient admissions associated with active visits that meet the given request criteria.

Available operations for Inpatient Admission

  1. Get Inpatient Admission

Get Inpatient Admission

Get Inpatient Admission

GET /openmrs/ws/rest/v1/emrapi/inpatient/admission?visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/emrapi/inpatient/admission?visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/emrapi/inpatient/admission?visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
  "results": [
    {
        "visit": visit,
        "patient": patient,
        "currentInpatientLocation": location,
        "adtEncounters": encounter[],
        "admissionEncounters": encounter[],
        "transferEncounters": encounter[],
        "dischargeEncounters": encounter[],
        "latestAdtEncounter": encounter,
        "admissionAndTransferEncounters": encounter[],
        "firstAdmissionOrTransferEncounter": encounter,
        "latestAdmissionOrTransferEncounter": encounter,
        "encounterAssigningToCurrentInpatientLocation": encounter,
        "discharged": boolean
    }
  ],
  "totalCount": integer
}

This endpoint returns paged data. The maximum number of results for any paged response is controlled by the webservices.rest module configuration.

Supported Parameters:

Available representations

Full representation:

Default Representation:

Ref Representation

All properties returned as ref representations

Custom Representation

Any custom representation is supported.

Inpatient Request

Overview

Provides a means to retrieve inpatient requests (eg. requests for admission, discharge, or transfer) associated with active visits that meet the given request criteria.

Available operations for Inpatient Request

  1. Get Inpatient Request

Get Inpatient Request

Get Inpatient Request

GET /openmrs/ws/rest/v1/emrapi/inpatient/inpatient/request?dispositionType=ADMIT&visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&dispositionLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true&v=full

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("/openmrs/ws/rest/v1/emrapi/inpatient/inpatient/request?dispositionType=ADMIT&visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&dispositionLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true&v=full")
  .method("GET", null)
  .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=")
  .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010")
  .build();
Response response = client.newCall(request).execute();


var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM=");
requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010");

var requestOptions = {
  method: 'GET',
  headers: requestHeaders,
  redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/emrapi/inpatient/inpatient/request?dispositionType=ADMIT&visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&dispositionLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true&v=full", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Success Response


{
  "results": [
    {
        "visit": visit,
        "patient": patient,
        "dispositionType": ADMIT | TRANSFER | DISCHARGE,
        "dispositionEncounter": encounter,
        "dispositionObsGroup": obs,
        "disposition": concept,
        "dispositionLocation": location
    }
  ],
  "totalCount": integer
}

This endpoint returns paged data. The maximum number of results for any paged response is controlled by the webservices.rest module configuration.

Supported Parameters:

Available representations

Full representation:

Default Representation:

Ref Representation

All properties returned as ref representations

Custom Representation

Any custom representation is supported.

Contributing

Help us keep this documentation up to date by forking this repository and submitting pull requests with improvements or corrections. The quality of our documentation depends on the collective contributions of persons just like you. Thank you for your contributions!

Our documentation is written in simple markdown. The markdown pages can be found in the repository under in the subfolder source/includes/. We use Slate to convert our markdown into a friendly and searchable format. More details on contributing may be found in the README of our repository.