⚡ Monitorozás.hu API dokumentáció
Eszközök és blacklist monitorok kezelése API-n keresztül
A Monitorozás.hu API-val külső rendszerekből is létrehozhatsz, lekérdezhetsz és törölhetsz monitorozott végpontokat és blacklist megfigyeléseket. Az API Bearer tokenes hitelesítést, jogosultságkezelést és IP szűrést is támogat.
Base URL
https://monitorozas.hu/api/v1
Auth
Bearer API kulcs
Scopes
Olvasás / Írás
Tartalom
Bevezetés
Az API jelenleg két fő erőforrást kezel: monitorozott eszközöket / végpontokat és blacklist monitorokat. A jogosultságok API kulcsonként szabályozhatók.
Devices
- webes vagy szolgáltatás alapú monitorozás
- domain vagy IP alapú célpont
- HTTP / HTTPS / TLS / origin / port alapú logika
Blacklist monitorok
- domain vagy IP alapú blacklist figyelés
- utolsó státusz és utolsó ellenőrzés lekérdezése
- azonos userhez kötött kezelés
Hitelesítés
Minden API kéréshez Bearer token szükséges az Authorization headerben.
Authorization: Bearer API_KULCSOD_IDE
Scopes
| Scope | Jelentés |
|---|---|
read |
Lekérdezés jogosultság |
write |
Létrehozás, módosítás, törlés jogosultság |
Kérés és válasz formátum
Kérés
JSON body küldésnél ezt a headert használd:
Content-Type: application/json
Válasz
A válasz mindig JSON.
{
"success": true,
"data": [...]
}
GET
https://monitorozas.hu/api/v1/me
Saját API kulcs és user adatok lekérdezése
Példa kérés
curl -i -X GET https://monitorozas.hu/api/v1/me \ -H "Authorization: Bearer API_KULCSOD_IDE"
Példa válasz
{
"success": true,
"data": {
"user_id": 1,
"key_id": 1,
"scopes": ["read", "write"]
}
}
Devices API
GET
https://monitorozas.hu/api/v1/devices
A userhez tartozó végpontok listázása
curl -i -X GET https://monitorozas.hu/api/v1/devices \ -H "Authorization: Bearer API_KULCSOD_IDE"
POST
https://monitorozas.hu/api/v1/devices/create
Új monitorozott végpont létrehozása
Támogatott fő mezők
| Mező | Típus | Leírás |
|---|---|---|
target_type | string | domain vagy ip |
target_value | string | Domain vagy IP |
service_type | string | web, ssh, smtp, stb. |
scheme | string | http vagy https web esetén |
port | int | Opcionális, automatikus is lehet |
host_header | string | Opcionális host header |
proxy_enabled | int/bool | Proxy mögötti mérés |
origin_host | string | Origin host vagy IP |
origin_scheme | string | Origin protokoll |
origin_port | int | Origin port |
check_public_http | int/bool | Publikus HTTP ellenőrzés |
check_public_https | int/bool | Publikus HTTPS ellenőrzés |
check_public_tls | int/bool | Publikus TLS ellenőrzés |
check_origin_http | int/bool | Origin HTTP/HTTPS ellenőrzés |
check_origin_tls | int/bool | Origin TLS ellenőrzés |
expect_status | int | Elvárt HTTP státuszkód |
location | string | Opcionális megjegyzés |
is_enabled | int/bool | Aktív vagy inaktív |
Példa web végpont létrehozás
curl -i -X POST https://monitorozas.hu/api/v1/devices/create \
-H "Authorization: Bearer API_KULCSOD_IDE" \
-H "Content-Type: application/json" \
-d '{
"target_type": "domain",
"target_value": "google.com",
"service_type": "web",
"scheme": "https",
"check_public_https": 1,
"check_public_tls": 1,
"expect_status": 200,
"location": "API teszt"
}'
Példa SSH végpont létrehozás
curl -i -X POST https://monitorozas.hu/api/v1/devices/create \
-H "Authorization: Bearer API_KULCSOD_IDE" \
-H "Content-Type: application/json" \
-d '{
"target_type": "domain",
"target_value": "pelda.hu",
"service_type": "ssh",
"location": "SSH teszt"
}'
DELETE
https://monitorozas.hu/api/v1/devices/delete?id=31
Végpont törlése azonosító alapján
curl -i -X DELETE "https://monitorozas.hu/api/v1/devices/delete?id=31" \ -H "Authorization: Bearer API_KULCSOD_IDE"
Blacklist monitor API
GET
https://monitorozas.hu/api/v1/blacklist-monitors
A userhez tartozó blacklist monitorok listázása
curl -i -X GET https://monitorozas.hu/api/v1/blacklist-monitors \ -H "Authorization: Bearer API_KULCSOD_IDE"
POST
https://monitorozas.hu/api/v1/blacklist-monitors/create
Új blacklist monitor létrehozása
Kötelező / támogatott mezők
| Mező | Típus | Leírás |
|---|---|---|
target_type | string | domain vagy ip |
target_value | string | Domain vagy IP |
is_enabled | int/bool | Aktív vagy inaktív |
Példa domain monitor
curl -i -X POST https://monitorozas.hu/api/v1/blacklist-monitors/create \
-H "Authorization: Bearer API_KULCSOD_IDE" \
-H "Content-Type: application/json" \
-d '{
"target_type": "domain",
"target_value": "smtp1.pelda.hu",
"is_enabled": 1
}'
Példa IP monitor
curl -i -X POST https://monitorozas.hu/api/v1/blacklist-monitors/create \
-H "Authorization: Bearer API_KULCSOD_IDE" \
-H "Content-Type: application/json" \
-d '{
"target_type": "ip",
"target_value": "1.2.3.4",
"is_enabled": 1
}'
DELETE
https://monitorozas.hu/api/v1/blacklist-monitors/delete?id=5
Blacklist monitor törlése azonosító alapján
curl -i -X DELETE "https://monitorozas.hu/api/v1/blacklist-monitors/delete?id=5" \ -H "Authorization: Bearer API_KULCSOD_IDE"
Hibák és státuszkódok
| HTTP kód | Hiba | Jelentés |
|---|---|---|
200 |
success |
Sikeres lekérdezés vagy törlés |
201 |
success |
Sikeres létrehozás |
400 |
invalid_id stb. |
Hiányzó vagy hibás bemeneti adat |
401 |
missing_api_key, invalid_api_key |
Hiányzó vagy hibás API kulcs |
403 |
insufficient_scope, ip_not_allowed |
Nincs jogosultság vagy IP tiltás |
404 |
unknown_*_route |
Ismeretlen erőforrás vagy route |
409 |
duplicate_device, duplicate_blacklist_monitor |
Duplikált rekord |
429 |
rate_limit_exceeded |
Túl sok kérés |
500 |
server_error, missing_table |
Szerveroldali hiba |
CLI példák
# Saját adatok
curl -i -X GET https://monitorozas.hu/api/v1/me \
-H "Authorization: Bearer API_KULCSOD_IDE"
# Devices lista
curl -i -X GET https://monitorozas.hu/api/v1/devices \
-H "Authorization: Bearer API_KULCSOD_IDE"
# Új web végpont
curl -i -X POST https://monitorozas.hu/api/v1/devices/create \
-H "Authorization: Bearer API_KULCSOD_IDE" \
-H "Content-Type: application/json" \
-d '{
"target_type": "domain",
"target_value": "google.com",
"service_type": "web",
"scheme": "https",
"check_public_https": 1,
"check_public_tls": 1,
"expect_status": 200,
"location": "API teszt"
}'
# Blacklist lista
curl -i -X GET https://monitorozas.hu/api/v1/blacklist-monitors \
-H "Authorization: Bearer API_KULCSOD_IDE"
# Új blacklist monitor
curl -i -X POST https://monitorozas.hu/api/v1/blacklist-monitors/create \
-H "Authorization: Bearer API_KULCSOD_IDE" \
-H "Content-Type: application/json" \
-d '{
"target_type": "domain",
"target_value": "smtp1.pelda.hu",
"is_enabled": 1
}'