diff --git a/index.php b/index.php index d240230..9355a9a 100644 --- a/index.php +++ b/index.php @@ -253,7 +253,9 @@ min-width: 40px; } .sc-200 { background: #e8f5e9; color: #2e7d32; } + .sc-401 { background:#ffebee;color:#c62828; } .sc-404 { background: #fff3e0; color: #e65100; } + .sc-405 { background:#e8eaf6;color:#283593; } .sc-503 { background: #ffebee; color: #c62828; } /* Code blocks */ @@ -524,88 +526,68 @@ - + + + +
- Permanently deletes every job document from the job Solr core.
- In production, requires valid API credentials.
-
- In production mode (NODE_ENV=production), you must provide
- X-API-Key and X-Cleanup-Secret headers matching
- api.env. In any other environment (test, dev,
- staging, etc.), these headers are not checked and any value is
- accepted.
+
+ Returns the total number of job listings and companies currently indexed in the Solr cores. + Useful for dashboard counters, statistics widgets, or monitoring integrations.
-| Header | Required | Description |
|---|---|---|
| X-API-Key | Production only | API key from CLEANUP_API_KEY in api.env |
| X-Cleanup-Secret | Production only | Secret from CLEANUP_SECRET in api.env |
| Content-Type | Yes | application/json |
{
- "confirmation": "DELETE_ALL_DATA"
-}
+ job Solr core for the total number of indexed jobscompany Solr core for the total number of indexed companiescurl -X DELETE "https://api.peviitor.ro/v1/empty/" \
- -H "X-API-Key: abc123xyz789" \
- -H "X-Cleanup-Secret: secret456def012" \
- -H "Content-Type: application/json" \
- -d '{"confirmation": "DELETE_ALL_DATA"}'
- curl -X DELETE "https://test.peviitor.ro/api/v1/empty/" \
- -H "Content-Type: application/json" \
- -d '{"confirmation": "DELETE_ALL_DATA"}'
+ curl -X GET "https://api.peviitor.ro/v1/total/" \ + -H "Accept: application/json"
{
- "message": "Jobs deleted successfully",
- "jobsDeleted": 42,
- "companiesDeleted": 10
-}
+ | Field | Type | Description | +
|---|---|---|
| total | object | Container object with count fields |
| total.jobs | number | Total number of job listings currently indexed |
| total.companies | number | Total number of companies currently indexed |
{
- "error": "Unauthorized - invalid credentials"
+ "total": {
+ "jobs": 18452,
+ "companies": 934
+ }
}
{
- "error": "Only DELETE method allowed"
+ "error": "Only GET method allowed"
}
+ Triggered when Solr is unreachable, returns an invalid response, or the environment is not configured.
+ The details field contains the underlying error message for debugging.
+
{
+ "error": "Job core unavailable",
+ "details": "SOLR_SERVER not set"
+}
+ {
+ "error": "Job core unavailable",
+ "details": "FETCH FAILED: http://... | Connection timed out"
+}
{
"error": "Job core unavailable",
- "details": "PROD_SERVER not set"
+ "details": "Invalid JSON response"
}
| Item | Details |
|---|---|
| Method | DELETE only |
| Auth | X-API-Key + X-Cleanup-Secret (production only) |
| Params | Body: {"confirmation": "DELETE_ALL_DATA"} |
| Method | GET only |
| Auth | None (public endpoint) |
| Params | None |
| Content-Type | application/json |