WebCheck Desk

API Details

Public status APIs and private mobile upload API for hourly Android checks.

Open websites list

Public APIs

List all websites GET https://webstatus.hicsindh.pk/api/websiteslist

Returns all website database IDs, names, and URLs.

Direct check by website ID GET https://webstatus.hicsindh.pk/api/checkwebsite/{id}

Checks the website immediately and returns online/offline, HTTP code, response time, and checked time. This does not save a log row.

Status history for charts GET https://webstatus.hicsindh.pk/api/websitestatus/{id}

Returns online/offline history by website database ID for chart generation.

Check all websites and store logs GET https://webstatus.hicsindh.pk/api/websitestatusall

Checks every saved website, stores each online/offline result in the database, and returns the checked details.

Private API

Store status from mobile device POST https://webstatus.hicsindh.pk/api/storewebsite

Requires header X-API-Key. Send website ID, datetime, and status after the Android device checks every hour.

Headers:
X-API-Key: YOUR_API_KEYContent-Type: application/json

Body:
{
  "website_id": 1,
  "datetime": "2026-05-28 15:00:00",
  "status": "online"
}

Kotlin Android Snippet

Uses OkHttp. Add OkHttp dependency in your Android project, then call these functions from a Worker scheduled every hour.

import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONObject
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

private const val BASE_URL = "https://webstatus.hicsindh.pk"
private const val API_KEY = "YOUR_API_KEY"

val client = OkHttpClient()

fun listWebsites(): String {
    val request = Request.Builder()
        .url("$BASE_URL/api/websiteslist")
        .get()
        .build()

    client.newCall(request).execute().use { response ->
        return response.body?.string() ?: ""
    }
}

fun checkWebsiteNow(websiteId: Int): String {
    val request = Request.Builder()
        .url("$BASE_URL/api/checkwebsite/$websiteId")
        .get()
        .build()

    client.newCall(request).execute().use { response ->
        return response.body?.string() ?: ""
    }
}

fun getWebsiteHistory(websiteId: Int): String {
    val request = Request.Builder()
        .url("$BASE_URL/api/websitestatus/$websiteId")
        .get()
        .build()

    client.newCall(request).execute().use { response ->
        return response.body?.string() ?: ""
    }
}

fun checkAllWebsitesAndStore(): String {
    val request = Request.Builder()
        .url("$BASE_URL/api/websitestatusall")
        .get()
        .build()

    client.newCall(request).execute().use { response ->
        return response.body?.string() ?: ""
    }
}

fun storeWebsiteStatus(websiteId: Int, status: String): String {
    val now = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(Date())
    val json = JSONObject()
        .put("website_id", websiteId)
        .put("datetime", now)
        .put("status", status)
        .toString()

    val body = json.toRequestBody("application/json".toMediaType())
    val request = Request.Builder()
        .url("$BASE_URL/api/storewebsite")
        .addHeader("X-API-Key", API_KEY)
        .post(body)
        .build()

    client.newCall(request).execute().use { response ->
        return response.body?.string() ?: ""
    }
}