A fully automated Postman collection for testing the OpenSRP to OpenMRS CMEDCore integration API. Every request uses dynamically generated, randomized test data — no manual data entry needed. Just import, set your environment, and run.
- Overview
- Collection Structure
- Prerequisites
- Setup & Installation
- Environment Variables
- API Reference
- Test Automation
- Random Data Generators
- How It Works — End to End
- Running the Collection
- Support & Contact
This Postman collection tests the full patient lifecycle integration between OpenSRP (Smart Register Platform) and OpenMRS (Open Medical Record System) through the CMEDCore REST API.
What it does:
- 🆕 Registers a new patient with fully randomized demographic data
- 🔍 Retrieves the patient profile and verifies every field matches what was sent
- 🔎 Searches for the patient using 7 different search types sequentially
- 💉 Submits vaccination service records for the registered patient
- ✅ Runs automated test cases to validate responses — positive, negative, and format checks
Base URL: https://dev.aaloclinic.org
Authentication: HTTP Basic Auth (credentials shared via secure channel)
OpenSRP - OpenMRS Integration
│
├── 📝 Patient Registration POST /openmrs/ws/rest/v1/cmedcore/patient
├── 👤 Patient Profile GET /openmrs/ws/rest/v1/patientprofile/{uuid}
├── 🔍 Patient Search for SRP GET /openmrs/ws/rest/v1/cmedcore/patient/search
└── 💉 Vaccination Service POST /openmrs/ws/rest/v1/cmedcore/vaccination
Each request contains:
- Pre-request Script — generates all random data before sending
- Post-response Script — validates the response against sent data
- Postman v10 or later
- Access to the OpenMRS CMEDCore dev environment
- Basic Auth credentials (contact the integration team)
1. Clone or download this repository
git clone https://github.com/MuksudulIslam/OpenSRP-OpenMRS-Integration-Postman-API-Testing.git2. Import the collection into Postman
- Open Postman
- Click Import → Select the file
OpenSRP - OpenMRS Integration.postman_collection.json
3. Create a Dev Environment
- Go to Environments → Add
- Name it
Dev Environment - Add the variable:
| Variable | Value |
|---|---|
base_URL |
https://dev.aaloclinic.org |
4. Select the environment
- In the top-right dropdown, select Dev Environment
5. Set your credentials
- Open the collection → Authorization tab
- Set type to Basic Auth
- Enter your username and password
6. Run the requests in order
1. Patient Registration → saves patientUuid + identifier
2. Patient Profile → verifies all fields using saved UUID
3. Patient Search → searches sequentially with 7 types
4. Vaccination Service → submits vaccination for saved patient
The collection uses Collection Variables to pass data between requests automatically. You do not need to set these manually — they are generated and saved by the Pre-request and Post-response scripts.
| Variable | Source | Description |
|---|---|---|
patientUuid |
POST Registration response | OpenMRS UUID of created patient |
identifier |
POST Registration response | OSRP patient identifier (e.g. OSRP-A1B2C3D4) |
correlationId |
POST Registration response | Correlation ID echoed from request |
firstName |
Pre-request script | Random first name |
lastName |
Pre-request script | Random last name |
middleName |
Pre-request script | Random middle name |
gender |
Pre-request script | Random: M, F, or O |
birthDate |
Pre-request script | Random date yyyy-mm-dd |
phoneNumber |
Pre-request script | BD format: 01XXXXXXXXX |
email |
Pre-request script | Random email address |
nationalId |
Pre-request script | Random 10-digit NID |
healthId |
Pre-request script | Random 11-digit HID starting with 9 |
brnNum |
Pre-request script | Random 17-digit Birth Registration Number |
fatherName |
Pre-request script | Random Bangladeshi father's name |
motherName |
Pre-request script | Random Bangladeshi mother's name |
spouseName |
Pre-request script | Random Bangladeshi spouse's name |
primaryRelativeName |
Pre-request script | Random relative's name |
bloodGroupValue |
Pre-request script | Random blood group UUID |
maritalStatusValue |
Pre-request script | Random marital status UUID |
occupationValue |
Pre-request script | Random occupation UUID |
financialStatusValue |
Pre-request script | Random financial status UUID |
addrDetails |
Pre-request script | Random House X, Road Y |
addrRuralWard |
Pre-request script | Random Block X, Section Y |
addrUnion |
Pre-request script | Random union/ward |
addrPaurasava |
Pre-request script | Random municipality |
addrUpazila |
Pre-request script | Random upazila |
addrZilla |
Pre-request script | Random zilla/district |
addrDivision |
Pre-request script | Random division |
searchType |
Patient Search pre-request | Current sequential search type |
searchValue |
Patient Search pre-request | Value for the current search type |
searchTypeIndex |
Patient Search pre-request | Sequential index counter (0–6) |
| Variable | Required | Description |
|---|---|---|
base_URL |
✅ | Base URL of the OpenMRS server |
Registers a new patient in OpenMRS with fully randomized demographic data.
Endpoint
POST {{base_URL}}/openmrs/ws/rest/v1/cmedcore/patient
Request Body
{
"correlationId": "OSRP-2026-04-30-ABC742XYZ",
"firstName": "Hassan",
"lastName": "Khan",
"middleName": "Jarin",
"gender": "M",
"birthdate": "1998-06-14",
"phoneNumber": "01723456789",
"healthId": "93507682850",
"addresses": [
{
"addressDetails": "House 45, Road 12",
"ruralWard": "Block A, Section 7",
"union": "Urban Ward No-01",
"paurasava": "Kushtia Paurashava",
"upazila": "Kushtia Sadar",
"zilla": "Kushtia",
"division": "Khulna"
}
],
"attributes": [
{ "attributeTypeUuid": "e3da58f8-62f0-490d-9783-5d6698f82870", "value": "hassan123@gmail.com" },
{ "attributeTypeUuid": "7b965aac-f1f1-455c-b048-198cfedf010a", "value": "5e81ec1c-356b-4ed4-bddc-f4e4fc660ba1" },
{ "attributeTypeUuid": "0d2bedcb-8c29-4c65-ae24-e8ffa7028531", "value": "47952ea6-bee5-49d9-9d74-6a6c43fabece" },
{ "attributeTypeUuid": "c58cbe66-7d55-11e5-acdf-90fba67c4298", "value": "6f5e9a03-78bf-46c2-ac69-592f86eed3b9" },
{ "attributeTypeUuid": "c13827bd-7d55-11e5-acdf-90fba67c4298", "value": "3574360411" },
{ "attributeTypeUuid": "d1e087e5-7d55-11e5-acdf-90fba67c4298", "value": "429352172932061816" },
{ "attributeTypeUuid": "d312809a-7d55-11e5-acdf-90fba67c4298", "value": "Mohammad Rahman" },
{ "attributeTypeUuid": "d32e8ca4-7d55-11e5-acdf-90fba67c4298", "value": "Fatema Islam" },
{ "attributeTypeUuid": "d34ed338-7d55-11e5-acdf-90fba67c4298", "value": "Rahela Hossain" },
{ "attributeTypeUuid": "6071af61-a30c-4243-a1b8-acb35fd6f20f", "value": "Abdul Karim" },
{ "attributeTypeUuid": "2cc7da0a-7616-44ba-8525-aa0d1e7ce25e", "value": "068951bb-05e7-4f69-9cc1-a5282b9e1a32" }
]
}Success Response — HTTP 201 Created
{
"correlationId": "OSRP-2026-04-30-ABC742XYZ",
"patientUuid": "0673f4a3-a573-4b5c-a0ed-9a96cdf3dcd0",
"identifier": "OSRP-0F34E1A8",
"message": "Patient created successfully"
}Attribute UUID Reference
| Attribute | Type | UUID |
|---|---|---|
| Email Address | String | e3da58f8-62f0-490d-9783-5d6698f82870 |
| Blood Group | Concept | 7b965aac-f1f1-455c-b048-198cfedf010a |
| Marital Status | Concept | 0d2bedcb-8c29-4c65-ae24-e8ffa7028531 |
| Occupation | Concept | c58cbe66-7d55-11e5-acdf-90fba67c4298 |
| National ID | String | c13827bd-7d55-11e5-acdf-90fba67c4298 |
| Birth Registration ID | String | d1e087e5-7d55-11e5-acdf-90fba67c4298 |
| Father Name | String | d312809a-7d55-11e5-acdf-90fba67c4298 |
| Spouse Name | String | d32e8ca4-7d55-11e5-acdf-90fba67c4298 |
| Mother Name | String | d34ed338-7d55-11e5-acdf-90fba67c4298 |
| Primary Relative | String | 6071af61-a30c-4243-a1b8-acb35fd6f20f |
| Financial Status | Concept | 2cc7da0a-7616-44ba-8525-aa0d1e7ce25e |
Post-response Tests (6 test cases)
| Test | What it checks |
|---|---|
| Patient created successfully | message equals "Patient created successfully" |
| Correlation ID is present | correlationId is not null |
| Patient UUID is present | patientUuid is not null |
| Identifier is present | identifier is not null |
| Status code is 201 | HTTP status = 201 |
| Response time < 3000ms | Response within 3 seconds |
Retrieves the full patient profile from OpenMRS using the patientUuid saved from registration and verifies every field matches what was sent.
Endpoint
GET {{base_URL}}/openmrs/ws/rest/v1/patientprofile/{{patientUuid}}
No request body required. The patientUuid is automatically set from the Registration response.
Post-response Tests (25+ test cases)
| Category | Tests |
|---|---|
| Name | First + middle name in givenName, last name matches |
| Demographics | Gender, birthdate match |
| Contact | Phone number, email match |
| Address | All 7 address fields match (addressDetails, ruralWard, union, paurasava, upazila, zilla, division) |
| Attributes | Blood group, marital status, occupation, financial status UUIDs match |
| IDs | National ID, Health ID, BRN match |
| Family | Father name, mother name, spouse name, primary relative match |
| Integrity | Patient not voided, UUID not null, gender not null, birthdate not null |
Searches for the registered patient using 7 different search types sequentially. Each time you hit Send, the next search type is automatically used.
Endpoint
GET {{base_URL}}/openmrs/ws/rest/v1/cmedcore/patient/search?type={{searchType}}&value={{searchValue}}
Search Types (cycle automatically)
| # | Type | Match | Returns | Example Value |
|---|---|---|---|---|
| 1 | uuid |
Exact | 1 patient | 0673f4a3-a573-4b5c-... |
| 2 | identifier |
Exact | 1 patient | OSRP-0F34E1A8 |
| 3 | phone |
Exact | 1 or more | 01723456789 |
| 4 | hid |
Exact | 1 patient | 93507682850 |
| 5 | nid |
Exact | 1 patient | 3574360411 |
| 6 | brn |
Exact | 1 patient | 429352172932061816 |
| 7 | name |
Partial | 1 or more | Hassan |
⚠️ Phone and Name searches may return multiple patients. The script automatically finds the correct patient by UUID from the results and runs all verifications against it.
Example Response
{
"searchType": "uuid",
"searchValue": "0673f4a3-a573-4b5c-a0ed-9a96cdf3dcd0",
"total": 1,
"patients": [
{
"patientUuid": "0673f4a3-a573-4b5c-a0ed-9a96cdf3dcd0",
"givenName": "Hassan Jarin",
"familyName": "Khan",
"gender": "M",
"age": 27,
"birthdate": 908474400000,
"preferredIdentifier": "OSRP-0F34E1A8",
"healthId": "93507682850",
"phoneNumber": "+8801723456789",
"nationalId": "3574360411",
"birthRegistrationNumber": "429352172932061816",
"identifiers": [...],
"addresses": [...],
"attributes": [...]
}
]
}Post-response Tests (40+ test cases)
| Category | Tests |
|---|---|
| Status | HTTP 200, response < 3000ms |
| Structure | Has searchType, total, patients array |
| [UUID] | Exactly 1 result, UUID matches, correct patient cross-checked |
| [IDENTIFIER] | Exactly 1 result, identifier matches, UUID cross-check |
| [PHONE] | Patient found in results, phone number matches, no null phones |
| [HID] | Exactly 1 result, healthId matches, UUID cross-check |
| [NID] | Exactly 1 result, nationalId matches, UUID cross-check |
| [BRN] | Exactly 1 result, BRN matches, UUID cross-check |
| [NAME] | Patient found in results, all results contain keyword |
| Data integrity | All patients have valid UUID format, no duplicate UUIDs, total = array length |
| Patient data | Name, gender, birthdate, phone, email, IDs, address, family all verified |
💡 Bug detection example: If the phone search returns
200 OKbut the patient is missing from results, the test fails with:BUG DETECTED: Phone search returned 200 OK but our patient (UUID: 0673f4a3-...) is missing from 0 result(s). API may not be fetching phone data correctly.
Submits a vaccination record for the registered patient with a randomly generated vaccine, dose number, and event date.
Endpoint
POST {{base_URL}}/openmrs/ws/rest/v1/cmedcore/vaccination
Request Body
{
"formSubmissionId": "7f3d2a1c-4b5e-4f6a-9c8d-1e2f3a4b5c6d",
"patientUuid": "{{patientUuid}}",
"eventDate": "2023-08-17T14:32:45.123+06:00",
"dose": "OPV",
"doseNo": 3
}Randomized fields
| Field | Format | Random Range |
|---|---|---|
formSubmissionId |
UUID v4 | Unique every send |
eventDate |
yyyy-MM-ddTHH:mm:ss.SSS+06:00 |
2020-01-01 to today |
dose |
String | BCG, PENTAVALENT, PCV, OPV, IPV, MR, TD |
doseNo |
Integer | 1 to 10 |
patientUuid is automatically reused from the Patient Registration response.
Send #1: Patient Registration
→ generates random patient data
→ saves patientUuid + identifier for next requests
Send #2: Patient Profile
→ fetches patient by UUID
→ verifies 25+ fields match registration data
Send #3–9: Patient Search (7 sends = all search types)
→ Send 3: type=uuid
→ Send 4: type=identifier
→ Send 5: type=phone
→ Send 6: type=hid
→ Send 7: type=nid
→ Send 8: type=brn
→ Send 9: type=name
→ each send verifies the correct patient is returned
Send #10: Vaccination Service
→ submits random vaccine record for the patient
After each Send, click Test Results in the response panel:
Test Results (25/25 passed)
✅ First name and Middle name matches in givenName
✅ Last name matches
✅ Gender matches
✅ Birthdate matches
✅ Phone number matches
✅ Email matches
...
- Click Run collection (▶ button next to collection name)
- Set iteration count and delay
- Click Run OpenSRP - OpenMRS Integration
- All 4 requests run in sequence automatically
Every field is generated fresh on each send — no hardcoded test data.
- First names: 20 international names (James, Hassan, Fatima, Noah...)
- Last names: 10 Bangladeshi surnames (Rahman, Khan, Hossain...)
- Father/Mother/Spouse names: 70+ Bangladeshi first × 70+ last = 4,900+ combinations
National ID (NID) : 10 random digits e.g. 3574360411
Health ID (HID) : starts with 9, 11 digits e.g. 93507682850
Birth Reg Number (BRN) : 17 random digits e.g. 429352172932061816
Phone : 01XXXXXXXXX format e.g. 01723456789
formSubmissionId : UUID v4 e.g. 7f3d2a1c-4b5e-...
Blood Group — 8 options: A+, A−, B+, B−, O+, O−, AB+, AB−
Marital Status — 5 options: Single, Married, Widowed, Divorced, Separated
Occupation — 35+ options: Doctor, Engineer, Teacher, Farmer, Student...
Financial Status — 3 options: POP, Poor, Able to pay
Vaccines — 7 options: BCG, PENTAVALENT, PCV, OPV, IPV, MR, TD
┌─────────────────────────────────────────────────────────────┐
│ PRE-REQUEST SCRIPT │
│ Generates: name, gender, DOB, phone, email, NID, HID, │
│ BRN, address, occupation, blood group, etc. │
│ Saves all values as collection variables │
└─────────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ HTTP REQUEST │
│ Uses {{variables}} in body/URL │
│ Sends to OpenMRS CMEDCore API │
└─────────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ POST-RESPONSE SCRIPT │
│ Reads response → compares every field against │
│ what was sent → passes or fails each test case │
│ Saves patientUuid + identifier for next requests │
└─────────────────────────────────────────────────────────────┘
The search index auto-increments every send and resets after all 7 types:
searchTypeIndex: 0 → uuid
searchTypeIndex: 1 → identifier
searchTypeIndex: 2 → phone
searchTypeIndex: 3 → hid
searchTypeIndex: 4 → nid
searchTypeIndex: 5 → brn
searchTypeIndex: 6 → name
searchTypeIndex: 7 → resets to 0 (uuid)To reset manually: go to Collection → Variables and set searchTypeIndex to 0.
Run in this order inside Postman:
Patient RegistrationPatient ProfilePatient Search for SRP(send 7 times for all search types)Vaccination Service
- Click the ▶ Run button next to the collection
- Set Iterations: 1, Delay: 500ms
- Click Run
For the search API, run with Iterations: 7 to cycle through all 7 search types automatically.
# Install Newman
npm install -g newman
# Run the collection
newman run "OpenSRP - OpenMRS Integration.postman_collection.json" \
--environment Dev_Environment.json \
--reporters cli,json \
--reporter-json-export results.jsonAll requests use HTTP Basic Authentication.
In Postman:
- Open the collection → Authorization tab
- Type: Basic Auth
- Enter username and password (provided via secure channel)
In Newman:
newman run collection.json \
--global-var "username=your_user" \
--global-var "password=your_pass"| HTTP Code | Scenario | Response |
|---|---|---|
400 |
Validation error, missing field, invalid date | { "code": "VALIDATION_ERROR", "message": "..." } |
401 |
Invalid/missing credentials | { "error": "AUTHENTICATION_FAILED" } |
409 |
Duplicate patient (NID/HID conflict) | { "error": "DUPLICATE_PATIENT", "existingUuid": "..." } |
500 |
Server-side error | { "code": "INTERNAL_ERROR", "message": "..." } |
| Role | Contact |
|---|---|
| Technical Integration | Polak Das (Backend Developer) — ploak.cmed@gmail.com |
| Documentation & Testing | Jubair Rahman (QA, project Coordinator) — jubair.cmed@gmail.com |
| API Automate Testing | Muksudul Islam (Software QA) — muksudul.cmed@gmail.com |
This project is licensed under the MIT License.
Built for OpenSRP × OpenMRS CMEDCore Integration Testing
CMED Health Ltd · Bangladesh Health System