forked from Shared/esg
documentation
This commit is contained in:
@@ -9,6 +9,7 @@ Complete API reference for the ESG Inquiry Gateway with request/response example
|
||||
- [Shahkar Inquiry](#shahkar-inquiry)
|
||||
- [Postal Code Inquiry](#postal-code-inquiry)
|
||||
- [Sheba Inquiry](#sheba-inquiry)
|
||||
- [Health and Diagnostic Checks](#health-and-diagnostic-checks)
|
||||
- [Error Responses](#error-responses)
|
||||
|
||||
## Base URL
|
||||
@@ -32,6 +33,83 @@ X-API-Key: your-api-key-here
|
||||
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
|
||||
```
|
||||
|
||||
## Health and Diagnostic Checks
|
||||
|
||||
### Liveness and readiness
|
||||
|
||||
`GET /health/live` reports whether the process is responding. `GET /health/ready`
|
||||
checks PostgreSQL connectivity, heap usage, and disk usage. A failed readiness
|
||||
check returns HTTP `503`; both probes are intended for deployment monitoring and
|
||||
do not require a user JWT.
|
||||
|
||||
### Run one diagnostic inquiry
|
||||
|
||||
These administrative endpoints make a real request to the configured provider
|
||||
using the supplied sample payload. They require a JWT for a user with the
|
||||
`ADMIN` or `SUPER_ADMIN` role. Use the request body expected by the selected
|
||||
inquiry type. The report includes provider, duration, tracking code, attempt
|
||||
summary, and error details, but does not include the inquiry response data.
|
||||
|
||||
```http
|
||||
POST /health/inquiries/check
|
||||
Authorization: Bearer <accessToken>
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"inquiryType": "SHAHKAR",
|
||||
"sampleData": {
|
||||
"nationalCode": "4311402422",
|
||||
"mobileNo": "09226187419"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The response reports `healthy: true` for a successful lookup or a valid no-match
|
||||
result. Provider or operational errors report `healthy: false`.
|
||||
|
||||
### Run a batch of diagnostic inquiries
|
||||
|
||||
Submit between 1 and 50 checks. They run sequentially in the background. The
|
||||
endpoint immediately returns a report with a `jobId`; poll that job to see
|
||||
progress and the final per-check results.
|
||||
|
||||
```http
|
||||
POST /health/inquiries/check/batch
|
||||
Authorization: Bearer <accessToken>
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"checks": [
|
||||
{
|
||||
"caseId": "shahkar-row-1",
|
||||
"inquiryType": "SHAHKAR",
|
||||
"sampleData": {
|
||||
"nationalCode": "4311402422",
|
||||
"mobileNo": "09226187419"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The start request returns HTTP `202 Accepted`. Only one batch may be queued or
|
||||
running at a time; another start request receives `409 Conflict`. Batch state is
|
||||
held in process memory, and completed reports expire after one hour.
|
||||
|
||||
```http
|
||||
GET /health/inquiries/check/batch/{jobId}
|
||||
Authorization: Bearer <accessToken>
|
||||
```
|
||||
|
||||
The report contains `status` (`QUEUED`, `RUNNING`, `COMPLETED`, or `FAILED`),
|
||||
`totalChecks`, `completedChecks`, healthy/failed counts, a percentage, timestamps,
|
||||
and per-check outcomes (`SUCCESS`, `NO_MATCH`, or `FAILURE`). A missing or expired
|
||||
job returns `404 Not Found`.
|
||||
|
||||
## Person Inquiry
|
||||
|
||||
Query person information using national code and birth date.
|
||||
|
||||
Reference in New Issue
Block a user