⚡ Architecture & Global Authentication
PhsAPI operates on a strict metadata-driven architecture governing SQL generation, payload validation, audit logging, autonumbering, and routing dynamically at runtime based on JSON schema files.
Required Request Headers
| Header Name | Type | Description | Example |
|---|---|---|---|
| Authorization | String | Bearer JWT Token issued by POST /PhsAPI/Auth/Login | Bearer eyJhbGciOi... |
| x-period-id | Number | Operating Period ID (Injected into Mode 11 autonumber queries) | 2026 |
| accept-language | String | Response locale language code (en or ar) | en |
🚀 Generic Metadata REST Endpoints
POST
/PhsAPI/Auth/Login
User Authentication & JWT Issuance
Authenticates username and password against tenant user table (Copy_Users / Cpy_User) and returns a signed 24h JWT token.
curl -X POST http://localhost:3000/PhsAPI/Auth/Login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "PhPass", "vCopy": "MKM", "periodId": 2026}'
GET POST
/PhsAPI/UserAccount/getUserProfile
Get User Profile, Permissions, and Programs
Retrieves the authenticated user's profile, permission group, and allowed programs (menu). Requires a valid JWT token.
curl -X GET http://localhost:3000/PhsAPI/UserAccount/getUserProfile \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
POST
/PhsAPI/:package/:table/New
Create New Record + Children
Validates input payload, computes autonumbers (Sequences / Max aggregation), injects audit fields (insUser, insDate), and inserts master and child arrays atomically in a transaction.
curl -X POST http://localhost:3000/PhsAPI/Acc/Master/New \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "x-period-id: 2026" \
-H "Content-Type: application/json" \
-d '{
"docNo": "DOC-2026-001",
"mdate": "01-08-2026",
"notes": "Accounting Entry",
"transactions": [{ "accountNo": "101", "amount": 5000.00 }]
}'
GET
/PhsAPI/:package/:table/List
List / Filter Records
Fetches paginated and filtered entity records using database-native pagination syntax (Oracle 12c+ FETCH NEXT, MySQL LIMIT OFFSET).
curl -X GET "http://localhost:3000/PhsAPI/Acc/Master/List?page=1&pageSize=10&docNo=DOC-2026-001" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
GET
/PhsAPI/:package/:table/Get/:id
Get Record by ID + Children
Retrieves parent record by primary key and automatically fetches and nests child record arrays.
curl -X GET "http://localhost:3000/PhsAPI/Acc/Master/Get/1001" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
PUT
/PhsAPI/:package/:table/Update/:id
Update Record
Validates update permissions on writable fields, injects update audit fields (updUser, updDate), and updates record.
curl -X PUT "http://localhost:3000/PhsAPI/Acc/Master/Update/1001" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"notes": "Updated Entry Notes"}'
DELETE
/PhsAPI/:package/:table/Delete/:id
Delete Record
Deletes record by primary key and automatically cascades deletion to child records if cascadeDelete = true.
curl -X DELETE "http://localhost:3000/PhsAPI/Acc/Master/Delete/1001" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
GET
/PhsAPI/:package/:table/Autocomplete
Execute Autocomplete Search
Executes optimized search queries across 374+ autocomplete templates with runtime parameter substitution.
curl -X GET "http://localhost:3000/PhsAPI/Acc/Account/Autocomplete?term=cash" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
📦 Entity Catalog
Select a package from the sidebar to inspect its entity models and schema details.