Kom igång
⚡ Quickstart
API:et använder enkla HTTP GET-anrop. Din personliga API-nyckel krävs för autentisering. Bas-URL enligt OpenAPI-specifikationen.
🔒 All kommunikation sker över TLS 1.3
Parametrar
| Parameter | Typ | Krävs | Beskrivning |
|---|---|---|---|
| key | string | Ja | Din personliga API-nyckel |
| action | enum | Ja |
status
categories
category
incidents
stats
|
| format | enum | Nej |
full
simple
grouped
(endast för action=status)
|
| category_id | integer | Vid action=category | ID för kategori att hämta |
Endpoints
/api.php
action=status
Hämtar realtidsstatus för alla aktiva monitorer. Stöder olika format via format-parametern.
{
"status": "success",
"api_version": "2.1",
"data": [
{
"id": 1,
"name": "Web Server 01",
"type": "http",
"target": "status.bitup.se",
"port": 443,
"status": "up",
"last_check": "2026-02-14 22:54:01",
"is_active": 1,
"category_id": 1,
"category_name": "Webbhotell"
}
]
}
action=categories
Hämtar alla kategorier med statistik över monitorer.
{
"status": "success",
"api_version": "2.1",
"data": [
{
"id": 1,
"name": "Webbhotell",
"display_order": 1,
"monitor_count": 2,
"up_count": 2,
"down_count": 0
},
{
"id": 2,
"name": "Spelservrar",
"display_order": 2,
"monitor_count": 1,
"up_count": 1,
"down_count": 0
}
]
}
action=category
Hämtar en specifik kategori med dess monitorer. Kräver category_id.
{
"status": "success",
"api_version": "2.1",
"data": {
"id": 1,
"name": "Webbhotell",
"display_order": 1,
"monitor_count": 2,
"up_count": 2,
"monitors": [
{
"id": 6,
"name": "Netbox (dokumentation)",
"type": "http",
"target": "netbox.bitup.se",
"port": null,
"status": "up",
"last_check": "2026-02-14 22:54:01"
},
{
"id": 9,
"name": "Web-node-se01",
"type": "http",
"target": "da1.bitup.se",
"port": null,
"status": "up",
"last_check": "2026-02-14 22:54:01"
}
]
}
}
action=incidents
Returnerar incidenter med tillhörande uppdateringar och kategori-info.
{
"status": "success",
"api_version": "2.1",
"data": [
{
"id": 45,
"title": "Nätverksfördröjning SE-STHLM",
"type": "down",
"is_active": 1,
"created_at": "2026-02-14 10:00:00",
"monitors": ["Web-node-se01", "Netbox"],
"categories": ["Webbhotell"],
"updates": [
{
"message": "Vi undersöker problemet",
"created_at": "2026-02-14 10:30:00"
},
{
"message": "Felet är åtgärdat",
"created_at": "2026-02-14 11:15:00"
}
]
}
]
}
action=stats
Systemstatistik - totala monitorer, online/offline, uptime och kategoriuppdelning.
{
"status": "success",
"api_version": "2.1",
"data": {
"total": 10,
"online": 9,
"offline": 1,
"uptime_percent": 98.7,
"categories": [
{
"id": 1,
"category_name": "Webbhotell",
"total_in_category": 5,
"up_in_category": 5,
"down_in_category": 0,
"uptime_percent_category": 100
},
{
"id": 2,
"category_name": "Spelservrar",
"total_in_category": 5,
"up_in_category": 4,
"down_in_category": 1,
"uptime_percent_category": 80
}
]
}
}
Schemas
ApiResponse
| Fält | Typ | Beskrivning |
|---|---|---|
| status | string | "success" eller "error" |
| api_version | string | "2.1" |
| data | array/object | Dynamisk data baserad på action |
Monitor (full)
| Fält | Typ | Beskrivning |
|---|---|---|
| id | integer | Unikt ID |
| name | string | Namn på monitorn |
| type | string | http, ping, tcp |
| target | string | URL eller IP |
| port | integer/null | Port (om tillämpligt) |
| status | string | up, down, pending, maintenance |
| last_check | date-time | Senaste kontroll |
| category_id | integer/null | Kategori-ID |
| category_name | string/null | Kategorinamn |
Stats
| Fält | Typ | Beskrivning |
|---|---|---|
| total | integer | Totalt antal monitorer |
| online | integer | Antal uppe |
| offline | integer | Antal nere |
| uptime_percent | number | Total uptime % |
| categories | array | Statistik per kategori |
Error Responses
Nyckel saknas eller är felaktig
{
"status": "error",
"message": "Invalid API key. Access denied."
}
Ogiltig action eller saknad parameter
{
"status": "error",
"message": "category_id required"
}
Kategori hittades inte
{
"status": "error",
"message": "Category not found"
}
Ogiltig action
{
"status": "error",
"message": "Invalid action. Supported: status, categories, incidents, stats, category"
}