Initial Release
This guideline provides an overview of how to design and implement a REST API interface for querying patient demographic data from an Electronic Patient Record (EPR) system using HealthConnect. The process involves sending a query request with the patientβs identification number, retrieving the response from the EPR system, extracting the required patient demographic data from the HL7 message, and sending it as a JSON response to the supplier. The high-level process diagram is shown below (Screenshot 1).
π¨ Note: You can modify or add code and other features according to your requirements. This is just a basic guideline Iβve created for quick solutions.

The step-by-step guideline is provided below:
π Navigate to Web Application Setup
Go to: System Administration β Security β Application β Web Application.
β Create a New Web Application
β‘ Enable REST
πΎ Save Your Configuration
πΈ Screenshot 2: Web Application and Setting Up REST

GetRequestDatasetsπ Open Cache Studio
β Create a New Class
File β New β General β Class Definition β OK.π Enter Class Details
GetRequestDatasetsπΈ Screenshot 3: Code for GetRequestDatasets

SetResponseDatasetsβ οΈ Note: You can add or remove properties according to your requirements.
β Create a New Class
SetResponseDatasetsπ Add the Code
πΈ Screenshot 4: Code for SetResponseDatasets

QueryRequestResponseβ Create a New Business Process
QueryRequestResponseπ Add the Code
πΈ Screenshot 5: Code for Business Process β QueryRequestResponse

β οΈ Note: "404 Not Found" is just a display message; you can configure this differently if needed.
GetRequestβ Create a New Business Service
GetRequestπ Add the Code
πΈ Screenshot 6: Code for Business Service β GetRequest

RestHandlerβ Create a New REST Handler
RestHandlerπ Add the Code
πΈ Screenshot 7: Code for RestHandler

Once all classes, business processes, services, and REST handlers are created and compiled, your Studio should display the following layout:
πΈ Screenshot 8: Studio Layout of RESTful API

Give the names (services, processes, operations) according to your requirements.
π οΈ Configure Services
...RESTfulAPI.SERVICES.GetRequestπ Configure Processes
...RESTfulAPI.PROCESS.QueryRequestResponseβ‘ Configure Operations
EnsLib.HL7.Operation.TCPOperation (for EPR System)β οΈ Note:
πΈ Screenshot 9: Management Portal β Production Configuration view

If you donβt already have it, download and install Postman to test the REST interface.
π Send a GET Request
https://......restapi/Patient?MRN=510800β Verify the Response
510800.πΈ Screenshot 10: Output of Test Case 1

π Send a GET Request
https://......restapi/510800β Verify the Response
510800.πΈ Screenshot 11: Output of Test Case 2

π Send a GET Request
https://......restapi/Patient?MRN=INVALID_MRNβ οΈ Verify the Response
πΈ Screenshot 12: Output of Test Case 3

β οΈ Scenario
π Send a Request
β Expected Output
πΈ Screenshot 13(a): Disabled Services β Output of Test Case 4

πΈ Screenshot 13(b): Disabled Services β Additional Output of Test Case 4

To better understand the flow of requests and responses, you can view the message visual trace in the Studio.
πΈ Screenshot 14: Visual Trace

πΈ Screenshot 15: Source Message

πΈ Screenshot 16: Process Message β Generate Message

πΈ Screenshot 17: Response from the EPR System β ADR^A19

This section provides a basic method to set up a username and password for accessing the REST API configured in HealthConnect.
For testing and demonstration purposes, Postman is used.
π Send a Request Without Credentials
β Expected Result
πΈ Screenshot 1: Unauthorized Access

π Navigate to User Management
System Administrator β Security β Users.β Create a New User
Test)restTest764)πΈ Screenshot 2: Creating a New User
πΈ Screenshot 3: Assigning Roles to the User

πΈ Screenshot 3: Assigning Roles to the User

π Log Out from the Management Portal
π€ Log In with the New User
Test / restTest764).β Verify Access

πΈ Screenshot 4: Limited-Access View for the User

β οΈ Note:
π Go to a Base64 Encoder
π Enter the Credentials
Username:PasswordTest:Test123π Copy the Encoded Value
πΈ Screenshot 5: BASE64 Encoding of Username and Password

π» Open Postman
βοΈ Go to the βHeadersβ Tab
π Enter Authorization Header
AuthorizationBasic <your_base64_encoded_value>πΈ Reference Screenshot
πΈ Screenshot 6: Setting Authorization Header in Postman

π Send the Request in Postman
β Verify the Response
π Example Response

π Share the BASE64 Credentials
β οΈ Security Note
π Final Tip
I hope this guide helps you set up and test your REST API successfully!