Skip to main content
GET
/
v3
/
ping
Health Check
curl --request GET \
  --url https://api.oneclickdz.com/v3/ping \
  --header 'X-Access-Token: <api-key>'
{
  "success": true,
  "data": {
    "api": "<string>",
    "operators": {
      "mobilis": "<string>",
      "ooredoo": "<string>",
      "djezzy": "<string>",
      "mobilisFixedPlans": "<string>"
    }
  },
  "meta": {
    "timestamp": "<string>"
  }
}

Overview

The health check endpoint allows you to verify the API service status and check the availability of each mobile operator.

Response

success
boolean
required
Always true if the API is operational
data
object
required
meta
object

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 requests
let 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 alternatives
if (data.data.operators.djezzy === 'down') {
  showNotification('Djezzy service temporarily unavailable. Try Mobilis or Ooredoo.');
}