Examples & SDKs

Sample payloads, Postman collections, and client libraries to accelerate your integration.

Postman Collection

Pre-configured requests for all FHIR endpoints including auth, patient search, and observation queries.

OpenAPI Specification

Machine-readable API definition for code generation and automated testing tools.

Sample FHIR Payloads

Patient Resource (MyCore)

				{ 
       "resourceType": "Patient", 
       "meta": { 
               "profile": [ 
                     "http://dhd.moh.gov.my/fhir/mycore/StructureDefinition/MY-Patient" 
               ]
        }, 
        "identifier": [ 
              { 
                      "system": "http://moh.gov.my/nric", 
                      "value": "123456789012" 
              } 
        ], 
        "name": [ 
              { 
                      "family": "Ahmad", 
                      "given": ["Ali", "bin"]
              } 
       ], 
       "gender": "male",
       "birthDate": "1985-03-15"
}
			

Observation Resource (Vital Signs)

				{ 
     "resourceType": "Observation",
     "status": "final", 
     "category": [ 
             { 
                    "coding": [ 
                            { 
                                  “system": "http://terminology.hl7.org/CodeSystem/observation-category",
                                  "code": "vital-signs" 
                            } 
                      ] 
              }
     ], 
     "code": { 
             "coding": [ 
                      { 
                             "system": "http://loinc.org", 
                             "code": "85354-9", 
                             "display": "Blood pressure panel"
                       }
               ] 
      }, 
     "subject": { 
             "reference": "Patient/123" 
      }, 
      "effectiveDateTime": "2024-11-12T10:30:00+08:00", 
      "component": [
             { "code": { 
                       "coding": [ 
                              { 
                                      "system": "http://loinc.org",
                                      "code": "8480-6", 
                                      "display": "Systolic blood pressure" 
                               } 
                         ]
                }, 
                "valueQuantity": { 
                         "value": 120,
                         "unit": "mmHg", 
                         "system": "http://unitsofmeasure.org", 
                         "code": "mm[Hg]" 
                }
           } 
      ]
  } 
			
Client SDKs

Python

FHIR client library with OAuth integration

				from dhd_fhir_client import FHIRClient  

client = FHIRClient( 
               base_url="https://sandbox.dhd.moh.gov.my/fhir/R4", 
               client_id="YOUR_CLIENT_ID", 
               client_secret="YOUR_CLIENT_SECRET" 
)  

# Search for patients 
patients = client.Patient.search(identifier="123456789012")

# Read observation 
obs = client.Observation.read("obs-123")
			

JavaScript/TypeScript

Node.js SDK with TypeScript definitions

				import { DHDClient } from '@moh-my/dhd-fhir-sdk';  

const client = new DHDClient({ 
          baseUrl: 'https://sandbox.dhd.moh.gov.my/fhir/R4', 
          credentials: { 
                    clientId: process.env.CLIENT_ID, 
                    clientSecret: process.env.CLIENT_SECRET 
          } 
});  

// Async/await style 
const bundle = await client.search('Patient', { 
          identifier: '123456789012' 
});