Function | Endpoint | Method | Request Payload | Success Response | Error Responses |
---|---|---|---|---|---|
Order Laboratory Tests | /api/lab_tests/order |
POST |
patientMID (String), testName (String), labName (String), instructions (String) |
200 OK - Success Message |
400 Bad Request - Missing or incorrect information401 Unauthorized - User not authenticated |
Process and Record Test Results | /api/lab_tests/record_results |
POST |
patientMID (String), testName (String), labName (String), results (String), notes (String) |
200 OK - Success Message |
400 Bad Request - Missing or incorrect information401 Unauthorized - User not authenticated |
View Laboratory Test Results | /api/lab_tests/view_results/{patientMID} |
GET |
patientMID (String) |
200 OK - Test Results |
404 Not Found - No results found401 Unauthorized - User not authenticated |
Before making any requests, users (Patients, HCPs, Lab Techs, Personal Representatives, or Administrators) need to authenticate themselves in iTrust2.
-
Endpoint:
/api/lab_tests/order
-
Method:
POST
-
Request Payload:
- Parameters:
patientMID
(String): MID (username) of the patient.testName
(String): Name of the laboratory test (Up to 250 alphanumeric characters).labName
(String): Name of the lab (Up to 250 alphanumeric characters).instructions
(String): Special instructions for the test (Up to 500 characters).
- Parameters:
-
Success Response:
- Status: 200 OK
- Content:
{ "message": "Laboratory tests ordered successfully." }
-
Error Responses:
- Status: 400 Bad Request
- Content:
{ "error": "Missing or incorrect information. Please check your request." }
- Content:
- Status: 401 Unauthorized
- Content:
{ "error": "User not authenticated." }
- Content:
- Status: 400 Bad Request
-
Endpoint:
/api/lab_tests/record_results
-
Method:
POST
-
Request Payload:
- Parameters:
patientMID
(String): MID (username) of the patient.testName
(String): Name of the laboratory test (Up to 250 alphanumeric characters).labName
(String): Name of the lab (Up to 250 alphanumeric characters).results
(String): Test results (Alphanumeric, up to 500 characters).notes
(String): Additional notes or observations (Up to 500 characters).
- Parameters:
-
Success Response:
- Status: 200 OK
- Content:
{ "message": "Laboratory test results recorded successfully." }
-
Error Responses:
- Status: 400 Bad Request
- Content:
{ "error": "Missing or incorrect information. Please check your request." }
- Content:
- Status: 401 Unauthorized
- Content:
{ "error": "User not authenticated." }
- Content:
- Status: 400 Bad Request
-
Endpoint:
/api/lab_tests/view_results/{patientMID}
-
Method:
GET
-
Request Parameters:
patientMID
(String): MID (username) of the patient.
-
Success Response:
- Status: 200 OK
- Content:
{ "testResults": [ { "testName": "Blood Test", "labName": "Central Lab", "results": "Normal", "notes": "No abnormalities detected." }, // ... other test results ] }
-
Error Responses:
- Status: 404 Not Found
- Content:
{ "error": "No laboratory test results found for the specified patient." }
- Content:
- Status: 401 Unauthorized
- Content:
{ "error": "User not authenticated." }
- Content:
- Status: 404 Not Found