POST User Login
Authenticates a registered user and returns JWT token and Ktoken for authorized API access.
๐ Endpoint: https://mainapi.hospitalsnepal.com/api/Authorization/Auth/Login
๐ค Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
๐ฆ Request Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| Code | string | Yes | Organization / System code |
| UserName | string | Yes | User's login username |
| Password | string | Yes | User's login password |
๐ Request Example
{
"Code": "PU",
"UserName": "admin",
"Password": "admin1234"
}
โ Success Response (200 OK)
{
"data": {
"userName": "admin",
"jwtToken": "eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9...",
"ktoken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
}
๐ Response Fields
| Field | Type | Description |
|---|---|---|
| data.userName | string | Authenticated username |
| data.jwtToken | string | JWT access token for API authorization |
| data.ktoken | string | Additional K-token for specific operations |
GET Dashboard Notifications
Fetches real-time dashboard cards including financial summaries, inventory alerts, lab status, and other notification metrics.
๐ Endpoint: https://notificationhub.hospitalsnepal.com/api/khatanotification/StartNotifications
๐ค Request Headers
| Header | Value | Required |
|---|---|---|
| Authorization | Bearer {jwtToken} | Yes |
๐ Request Example
GET /api/khatanotification/StartNotifications Host: notificationhub.hospitalsnepal.com Authorization: Bearer eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9...
โ Success Response (200 OK)
{
"message": "Request Completed",
"data": "[{\"Category\":\"Total\",\"Title\":\"Total Notification\",\"Total\":\"14\",\"Menu\":\"\",\"URL\":\"\",\"Remarks\":\"\",\"Auth\":1},{\"Category\":\"Financial\",\"Title\":\"Total Sales\",\"Total\":\"0.00\",\"Menu\":\"My Sales Report\",\"URL\":\"\\/customreport\\/customreport\\/index?menuName=My Sales Report\",\"Remarks\":\"Total sales summary of session user\",\"Auth\":0}]"
}
๐ Response Fields (Top-level)
| Field | Type | Description |
|---|---|---|
| message | string | Status of the request (e.g., "Request Completed") |
| data | string (JSON array) | A JSON string containing an array of notification items |
๐ Notification Item Fields (inside "data" array)
| Field | Type | Description |
|---|---|---|
| Category | string | Group category: Total, Financial, Inventory, Lab |
| Title | string | Display title for the metric (e.g., "Total Sales", "Expired Items") |
| Total | string | Value or count (sometimes includes percentage like "136 [15%]") |
| Menu | string | Associated menu name for navigation |
| URL | string | Relative URL to detailed report or view |
| Remarks | string | Additional info or instructions for the user |
| Auth | integer | 1 = Authorized, 0 = Not authorized (visibility flag) |
๐ Notification Categories Overview
| Category | Examples |
|---|---|
| Total | Total Notification count |
| Financial | Total Sales, Receivable, Payable, PDC Payable/Receivable |
| Inventory | Expired Items, Reorder Level, Over Stock, No Sales Item, IRD Sync. Pending |
| Lab | Sampled, Received, Reported, Verified (with percentages) |
๐ก Note: The
data field returns a stringified JSON array. You must parse it with JSON.parse() before using the array in your application.
โ ๏ธ Error Responses
| Status Code | Description |
|---|---|
| 401 Unauthorized | Missing, expired, or invalid JWT token. |
| 500 Internal Server Error | Server-side failure. |
๐ Authentication Flow
- Call
POST /api/Authorization/Auth/Loginwith valid Code, UserName, Password. - Extract
jwtTokenfrom the JSON response. - Use the token as a Bearer credential in the
Authorizationheader for all protected endpoints. - Request
GET /api/KhataNotification/StartNotificationswith the token to fetch dashboard data. - Parse the
datastring and render notification cards.
๐ The JWT token contains claims like UserId, Department, Permissions, Role and has an expiration timestamp. Refresh mechanism may be required after expiry.
๐ Additional Information
๐งฉ Full Dashboard Sample (Truncated)
[
{"Category":"Inventory","Title":"Expired Items","Total":"38","Menu":"Stock Expiry Report","URL":"/customreport/customreport/index?menuname=Stock Expiry Report","Remarks":"Expired item list having stock.","Auth":1},
{"Category":"Financial","Title":"Receivable","Total":"10","Menu":"Account Ledger Report","URL":"/customreport/customreport/index?menuname=Account Ledger Report","Remarks":"Receivable Account Ledger Report.","Auth":1},
{"Category":"Lab","Title":"Sampled","Total":"136 [15%]","Menu":"Test Status Report","URL":"/customreport/customreport/index?menuname=Test Status Report","Remarks":"Total Sampled and pending test up to today.","Auth":1}
]
๐ง cURL Examples
Login Request:
curl -X POST https://mainapi.hospitalsnepal.com/api/Authorization/Auth/Login \
-H "Content-Type: application/json" \
-d '{"Code":"PU","UserName":"admin","Password":"admin1234"}'
Dashboard Request:
curl -X GET https://notificationhub.hospitalsnepal.com/api/KhataNotification/StartNotifications \ -H "Authorization: Bearer YOUR_JWT_TOKEN_HERE"
โ
This API documentation covers User Login and Dashboard Notifications endpoints. All timestamps, token expiration, and permission claims are embedded inside the JWT tokens. For any integration issues, verify the token validity and required permissions (Auth flag) from the response.