Overview
The health check endpoint allows you to verify the API service status and check the availability of each mobile operator.
Response
Always true if the API is operational
Service status: "ok" or "error"
Status of each operator
Mobilis operator status: "up" or "down"
Ooredoo operator status: "up" or "down"
Djezzy operator status: "up" or "down"
Mobilis Fixed Plans (Sama | Pixx) status: "up" or "down"
Current server timestamp (ISO 8601 format)
Example Request
curl --request GET \
--url https://api.oneclickdz.com/v3/ping
Use Cases
Service Monitoring
Monitor API availability and operator status for uptime tracking
Pre-flight Checks
Verify service is operational before processing transactions
Operator Filtering
Hide unavailable operators from your UI
Health Dashboard
Build a status dashboard for your operations team
Integration Example
// Check service health before processing orders
async function canProcessOrders() {
try {
const response = await fetch("https://api.oneclickdz.com/v3/ping");
const data = await response.json();
if (data.data.api !== "ok") {
console.error("API service is down");
return false;
}
return true;
} catch (error) {
console.error("Health check failed:", error);
return false;
}
}
// Check specific operator availability
async function isOperatorAvailable(operator) {
const response = await fetch("https://api.oneclickdz.com/v3/ping");
const data = await response.json();
const operatorMap = {
Mobilis: "mobilis",
Ooredoo: "ooredoo",
Djezzy: "djezzy",
Pixx: "mobilisFixedPlans",
};
const operatorKey = operatorMap[operator];
return data.data.operators[operatorKey] === "up";
}
Best Practices
Check the health endpoint every 30-60 seconds to maintain an up-to-date view of service status.setInterval(async () => {
const response = await fetch('https://api.oneclickdz.com/v3/ping');
const data = await response.json();
updateServiceStatus(data.data);
}, 30000); // Check every 30 seconds
Cache the status for 30-60 seconds to avoid excessive requestslet cachedStatus = null;
let lastCheck = 0;
async function getServiceStatus() {
const now = Date.now();
if (cachedStatus && (now - lastCheck) < 30000) {
return cachedStatus;
}
const response = await fetch('https://api.oneclickdz.com/v3/ping');
cachedStatus = await response.json();
lastCheck = now;
return cachedStatus;
}
When an operator is down, inform users and suggest alternativesif (data.data.operators.djezzy === 'down') {
showNotification('Djezzy service temporarily unavailable. Try Mobilis or Ooredoo.');
}