# GAMEMONITORING > REST API GAMEMONITORING returnează date JSON despre servere, jucători, postări, istoricul online și voturi. Aici găsiți regulile de bază ale integrării și prima cerere. Parametrii și testarea cererilor sunt disponibile pe paginile metodelor. - [API GAMEMONITORING](https://gamemonitoring.ro/developers/docs/api.md) - [GAMEMONITORING MCP](https://gamemonitoring.ro/developers/docs/mcp.md) - [Adaugă server](https://gamemonitoring.ro/developers/docs/api/servers/__post.md) - [Server](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/__get.md) - [Jucătorii serverului](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/players/__get.md) - [Postări care menționează serverul](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/posts/__get.md) - [Graficul numărului de jucători pe server](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/stats/players_online/__get.md) - [Voturile serverului](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/votes/__get.md) - [Graficul voturilor serverului](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/votes/chart/__get.md) - [Top votanți ai serverului](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/votes/top/__get.md) - [Graficul numărului de jucători din proiect](https://gamemonitoring.ro/developers/docs/api/projects/:project_id/stats/players_online/__get.md) - [Voturile proiectului](https://gamemonitoring.ro/developers/docs/api/projects/:project_id/votes/__get.md) - [Graficul voturilor proiectului](https://gamemonitoring.ro/developers/docs/api/projects/:project_id/votes/chart/__get.md) - [Top votanți ai proiectului](https://gamemonitoring.ro/developers/docs/api/projects/:project_id/votes/top/__get.md) - [Vot](https://gamemonitoring.ro/developers/docs/api/votes/:vote_id/__get.md) - [Confirmă procesarea votului](https://gamemonitoring.ro/developers/docs/api/votes/:vote_id/claim/__post.md) - [Profil de utilizator](https://gamemonitoring.ro/developers/docs/api/users/:id/__get.md) - [Confirmă titularul contului](https://gamemonitoring.ro/developers/docs/api/users/verify-code/__post.md) - [Webhook](https://gamemonitoring.ro/developers/docs/webhook.md) - [Recompense pentru voturi](https://gamemonitoring.ro/developers/docs/webhook/vote.md) - [Adrese IP sistem](https://gamemonitoring.ro/developers/docs/ips.md) - [OpenAPI](https://gamemonitoring.ro/developers/docs/openapi.json) - [Documentația completă](https://gamemonitoring.ro/developers/docs/llms-full.txt) - [GAMEMONITORING MCP](https://api.gamemonitoring.net/mcp) --- # API GAMEMONITORING REST API GAMEMONITORING returnează date JSON despre servere, jucători, postări, istoricul online și voturi. Aici găsiți regulile de bază ale integrării și prima cerere. Parametrii și testarea cererilor sunt disponibile pe paginile metodelor. ## Adresa de bază https://api.gamemonitoring.ro ## Prima cerere Începeți cu datele publice ale unui server. ID-ul serverului se află la sfârșitul adresei paginii sale din GAMEMONITORING. ```bash curl --header 'Accept: application/json' 'https://api.gamemonitoring.ro/servers/1' ``` ## Alegeți metoda - [POST /servers — Adaugă server](https://gamemonitoring.ro/developers/docs/api/servers/__post.md) - [GET /servers/{server_id} — Server](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/__get.md) - [GET /servers/{server_id}/players — Jucătorii serverului](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/players/__get.md) - [GET /servers/{server_id}/posts — Postări care menționează serverul](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/posts/__get.md) - [GET /servers/{server_id}/stats/players_online — Graficul numărului de jucători pe server](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/stats/players_online/__get.md) - [GET /servers/{server_id}/votes — Voturile serverului](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/votes/__get.md) - [GET /servers/{server_id}/votes/chart — Graficul voturilor serverului](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/votes/chart/__get.md) - [GET /servers/{server_id}/votes/top — Top votanți ai serverului](https://gamemonitoring.ro/developers/docs/api/servers/:server_id/votes/top/__get.md) - [GET /projects/{project_id}/stats/players_online — Graficul numărului de jucători din proiect](https://gamemonitoring.ro/developers/docs/api/projects/:project_id/stats/players_online/__get.md) - [GET /projects/{project_id}/votes — Voturile proiectului](https://gamemonitoring.ro/developers/docs/api/projects/:project_id/votes/__get.md) - [GET /projects/{project_id}/votes/chart — Graficul voturilor proiectului](https://gamemonitoring.ro/developers/docs/api/projects/:project_id/votes/chart/__get.md) - [GET /projects/{project_id}/votes/top — Top votanți ai proiectului](https://gamemonitoring.ro/developers/docs/api/projects/:project_id/votes/top/__get.md) - [GET /votes/{vote_id} — Vot](https://gamemonitoring.ro/developers/docs/api/votes/:vote_id/__get.md) - [POST /votes/{vote_id}/claim — Confirmă procesarea votului](https://gamemonitoring.ro/developers/docs/api/votes/:vote_id/claim/__post.md) - [GET /users/{id} — Profil de utilizator](https://gamemonitoring.ro/developers/docs/api/users/:id/__get.md) - [POST /users/verify-code — Confirmă titularul contului](https://gamemonitoring.ro/developers/docs/api/users/verify-code/__post.md) ## Versiuni API Puteți selecta versiunea API prin parametrul opțional v din interogare. Versiunea actuală este 1.0.0. Versiunea determină căile disponibile, câmpurile cererii și formatul răspunsului. Fără v se folosește cea mai mică versiune acceptată. După retragerea ei, următoarea versiune minimă devine implicită. Specificați v pentru un contract fix. O versiune invalidă, repetată sau neacceptată returnează HTTP 400; pentru versiunile neacceptate, valorile disponibile sunt în error.data.supported_versions. ## Transmiterea parametrilor ID-urile sunt în calea cererii: server_id și project_id sunt ID-uri numerice GAMEMONITORING, iar vote_id identifică un vot. Înlocuiți parametrii dintre acolade cu valorile concrete. Filtrele, perioadele și paginarea se transmit după ? în URL. Codificați valorile prin URLSearchParams sau funcția bibliotecii folosite, în special poreclele și textul căutat. Pentru adăugarea unui server, trimiteți JSON cu Content-Type: application/json. connect este un host:port public, iar steam_app_id este Steam App ID al jocului. Folosiți query când portul de interogare diferă de cel de conectare. ## Formatul datelor HTTP 200 include rezultatul în response: un obiect, o listă sau un obiect cu items, în funcție de metodă. Consultați schema metodei; o listă goală nu este în sine o eroare. Unele câmpuri pot fi null sau absente. Aceste valori diferă de 0, false și textul gol; tratați separat datele lipsă. created_at, expires_at și last_update folosesc timpul Unix în secunde. Înmulțiți cu 1000 pentru JavaScript Date; pentru filtre, împărțiți Date.now() la 1000 și rotunjiți în jos. Păstrați identificatorii Steam pe 64 de biți ca șiruri de caractere. Conversia la JavaScript Number poate pierde precizia. ID-ul serverului GAMEMONITORING și Steam App ID al jocului sunt diferite. ## Erori și reîncercări Verificați statusul HTTP și obiectul error: code conține codul, message explicația, iar data detalii suplimentare când sunt disponibile. Textul depinde de regiune și se poate schimba; nu îl folosiți drept condiție în cod. Corectați erorile de parametri sau acces înainte de reîncercare. Tratați și erorile de rețea sau răspunsurile proxy care pot să nu conțină JSON. Datele reflectă ultima interogare a serverului și pot fi memorate în cache. Verificați last_update, alegeți un interval rezonabil de actualizare și memorați rezultatul în integrare. Interogarea frecventă a API nu accelerează actualizarea serverului de joc. ## Voturi și Webhook Configurați Webhook-ul proiectului pentru a reacționa la voturi noi. Verificați signature, ignorați testele is_test=true și folosiți event_id ca vote_id pentru a obține votul prin API. Verificați entity_type și entity_id și procesați o singură dată perechea event_type + event_id. Confirmați evenimentele de test cu un răspuns 2xx, fără a acorda recompense. ## Ajutor pentru integrare Pentru raportarea unei erori, pregătiți metoda HTTP, calea, parametrii, momentul cererii, statusul HTTP și error primit. Aceste date ajută la reproducerea problemei. ## OpenAPI ```json { "openapi": "3.1.1", "info": { "title": "GAMEMONITORING", "version": "1.0.0" }, "paths": { "/servers": { "post": { "operationId": "createServer", "summary": "Adaugă server", "description": "Adaugă un server după adresa de conectare sau returnează serverul existent.", "parameters": [ { "$ref": "#/components/parameters/ApiVersion" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "connect": { "type": "string", "minLength": 1, "example": "198.51.100.24:27015" }, "steam_app_id": { "type": "integer", "minimum": 0, "example": 730 }, "query": { "type": "integer", "minimum": 10, "maximum": 65535, "example": 27016 } }, "required": [ "connect", "steam_app_id" ] }, "example": { "connect": "198.51.100.24:27015", "steam_app_id": 730 } } } }, "responses": { "200": { "description": "Created or existing server", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServerCreateResult" }, "example": { "response": { "connect": "198.51.100.24:27015", "game": 730, "id": 100001, "name": "Example Arena", "request": "198.51.100.24:27016", "status": true } } } } }, "400": { "description": "Missing game or address, invalid address or offline server" }, "403": { "description": "Blocked address" }, "409": { "description": "Query address is already in use" }, "503": { "description": "Server creation service is unavailable" }, "504": { "$ref": "#/components/responses/QueryTimeout" }, "default": { "$ref": "#/components/responses/UnexpectedError" } } } }, "/servers/{server_id}": { "get": { "operationId": "getServer", "summary": "Server", "description": "Returnează datele publice ale serverului.", "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "server_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 1 } } ], "responses": { "200": { "description": "Server details response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServerEnvelope" }, "example": { "response": { "steam_id": "90123456789012345", "domain": null, "id": 1, "ip": "198.51.100.24", "port": 27015, "query": 27015, "project_id": 42, "color": 0, "city": "Prague", "description": "[]", "game": 730, "boosts": 3, "last_offline": 1782751200, "last_online": 1783201200, "icon": null, "name": "Example CS2 Server", "connect": "198.51.100.24:27015", "request": "198.51.100.24:27015", "map": "de_mirage", "gamemode": "Counter-Strike 2", "version": "1.41.6.5", "numplayers": 12, "maxplayers": 64, "bots": 0, "secured": true, "private": false, "country": "CZ", "status": true, "votes": 128, "points": 2450, "add_date": 1701541119, "last_update": 1783201200, "ban_reason": null, "banned": false, "wipe": null, "official": null, "wipe_period": null, "next_wipe": null, "pve": null, "pvp": null, "list_hidden": false, "hide_address": false, "hide_query": false, "position_game": 12, "language": "en", "parked": false, "app": { "id": 2, "steam_id": 730, "name": "Counter-Strike 2", "url": "counter-strike-2" }, "mods": [ { "id": 5, "name": "Admin System" }, { "id": 14, "name": "Advertisement" }, { "id": 9, "name": "Admins" }, { "id": 3, "name": "Admin Commands" } ], "disabled_modules": [] } } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "404": { "$ref": "#/components/responses/NotFound" }, "503": { "$ref": "#/components/responses/ServiceUnavailable" }, "504": { "$ref": "#/components/responses/QueryTimeout" }, "default": { "$ref": "#/components/responses/UnexpectedError" } } } }, "/servers/{server_id}/players": { "get": { "operationId": "getServerPlayers", "summary": "Jucătorii serverului", "description": "Returnează lista jucătorilor serverului.", "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "limit", "in": "query", "description": "Număr de elemente de la 1 la 100, implicit 50", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50, "example": 5 } }, { "$ref": "#/components/parameters/offset" }, { "name": "server_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 1 } } ], "responses": { "200": { "description": "Server players", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServerPlayersResult" }, "example": { "response": { "items": [ { "avatar": "no.jpg", "created": 1783200000, "last_online": 1783203600, "last_session_time": 0, "name": "NovaPlayer", "user": null, "username": null } ] } } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "503": { "$ref": "#/components/responses/ServiceUnavailable" }, "504": { "$ref": "#/components/responses/QueryTimeout" } } } }, "/servers/{server_id}/posts": { "get": { "operationId": "getServerPosts", "summary": "Postări care menționează serverul", "description": "Returnează postările publice cu o mențiune vizibilă a serverului indicat.", "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "before_created_at", "in": "query", "description": "Pentru pagina următoare, trimiteți `created_at` al ultimei postări în secunde Unix și `id` al acesteia în `before_id`. Păstrați celelalte filtre. Cursorul funcționează când `sort` și `period` sunt omise. Dacă setați oricare dintre ele, folosiți `offset`.", "schema": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } }, { "name": "before_id", "in": "query", "description": "ID-ul publicației pentru cursor", "schema": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } }, { "name": "conversation_post_id", "in": "query", "description": "ID-ul publicației din discuție", "schema": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } }, { "name": "period", "in": "query", "description": "Folosiți top pentru perioada celor mai bune publicații.", "schema": { "type": "string", "const": "top" } }, { "name": "reply_to_post_id", "in": "query", "description": "ID-ul publicației părinte", "schema": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 } }, { "name": "root_only", "in": "query", "description": "Valoarea 1 returnează doar publicațiile principale", "schema": { "type": "number", "const": 1 } }, { "name": "sort", "in": "query", "description": "Ordinea publicațiilor. Pentru cele mai bune publicații folosiți helpful-desc.", "schema": { "type": "string" } }, { "name": "visibility", "in": "query", "description": "Această operație returnează numai publicații publice.", "schema": { "type": "string", "const": "public" } }, { "name": "server_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 1 } }, { "name": "limit", "in": "query", "description": "Număr de elemente de la 1 la 100, implicit 20", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20, "example": 5 } }, { "$ref": "#/components/parameters/offset" }, { "name": "search", "in": "query", "schema": { "type": "string", "maxLength": 120, "example": "admin" } } ], "responses": { "200": { "description": "Public posts mentioning the server", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServerPostsResult" }, "example": { "response": [ { "id": 1001, "comment": "Great server! Thanks to the admin team.", "conversation_post_id": null, "language": "en", "moderation_needed": false, "replays": 0, "reply_to_post_id": null, "views": 25, "updated_at": null, "created_at": 1783200000, "translated_content": null, "user": { "avatar": "no.jpg", "id": 204801, "username": "demo_user" }, "images": [], "mentions": [ { "type": "server", "meta": { "game": { "id": 2, "name": "Counter-Strike 2", "steam_id": 730, "url": "counter-strike-2" }, "icon": null, "id": 1, "name": "Example CS2 Server" } } ], "reactions": [], "replays_items": [], "replays_items_count": 0 } ] } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "404": { "description": "Server not found" }, "503": { "$ref": "#/components/responses/ServiceUnavailable" }, "504": { "$ref": "#/components/responses/QueryTimeout" }, "default": { "$ref": "#/components/responses/UnexpectedError" } } } }, "/servers/{server_id}/stats/players_online": { "get": { "operationId": "getServerPlayerStats", "summary": "Graficul numărului de jucători pe server", "description": "Returnează graficul numărului de jucători cu minimul, media și maximul fiecărui interval.", "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "type", "in": "query", "description": "Perioada statisticilor: day, week sau month; implicit month", "schema": { "type": "string", "default": "month", "example": "week", "enum": [ "day", "week", "month" ] } }, { "name": "server_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 1 } } ], "responses": { "200": { "description": "Player statistics grouped by time interval", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ServerPlayerStatsResult" }, "example": { "response": { "items": [ { "avg_players": 12, "date": 1783200000, "maps": [ "de_mirage" ], "max_players": 16, "min_players": 8, "x": 1783200000, "y": 16 } ] } } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "503": { "$ref": "#/components/responses/ServiceUnavailable" }, "504": { "$ref": "#/components/responses/QueryTimeout" }, "default": { "$ref": "#/components/responses/UnexpectedError" } } } }, "/servers/{server_id}/votes": { "get": { "operationId": "getServerVotes", "summary": "Voturile serverului", "description": "Returnează lista voturilor pentru serverul indicat.", "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "user_id", "in": "query", "description": "Identificatorul utilizatorului", "schema": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, { "name": "server_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 42 } }, { "$ref": "#/components/parameters/limit" }, { "$ref": "#/components/parameters/offset" }, { "$ref": "#/components/parameters/sort" }, { "$ref": "#/components/parameters/order" }, { "$ref": "#/components/parameters/claimed" }, { "$ref": "#/components/parameters/nickname" }, { "$ref": "#/components/parameters/created" }, { "$ref": "#/components/parameters/created__gt" }, { "$ref": "#/components/parameters/created__gte" }, { "$ref": "#/components/parameters/created__lt" }, { "$ref": "#/components/parameters/created__lte" }, { "$ref": "#/components/parameters/expire" }, { "$ref": "#/components/parameters/expire__gt" }, { "$ref": "#/components/parameters/expire__gte" }, { "$ref": "#/components/parameters/expire__lt" }, { "$ref": "#/components/parameters/expire__lte" } ], "security": [], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "response": { "type": "array", "items": { "$ref": "#/components/schemas/VoteDetails" } } }, "required": [ "response" ] }, "example": { "response": [ { "claimed_at": null, "created_at": 1783200000, "entity_id": 42, "entity_type": "server", "expires_at": 1783243200, "id": "9824cabb-2203-437e-9b6c-aba43dde3e4b", "nickname": "NovaPlayer", "server": { "app": { "id": 2, "name": "Counter-Strike 2", "steam_id": 730, "url": "counter-strike-2" }, "game": 730, "icon": null, "id": 42, "name": "Example CS2 Server" }, "user": { "avatar": "no.jpg", "id": 204801, "username": "demo_user", "uuid": "d4f9c57e-7c8b-49c7-8d7e-b2f1a39f4a25", "connections": [] } } ] } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "503": { "$ref": "#/components/responses/ServiceUnavailable" }, "504": { "$ref": "#/components/responses/QueryTimeout" }, "default": { "$ref": "#/components/responses/UnexpectedError" } } } }, "/servers/{server_id}/votes/chart": { "get": { "operationId": "getServerVoteChart", "summary": "Graficul voturilor serverului", "description": "Returnează numărul de voturi pe zile.", "security": [], "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "server_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 42 } }, { "$ref": "#/components/parameters/period" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "response": { "type": "array", "items": { "type": "object", "properties": { "x": { "type": [ "integer", "string" ] }, "y": { "type": [ "integer", "string" ] } } } } }, "required": [ "response" ] }, "example": { "response": [ { "x": 1800000000, "y": 10 } ] } } } }, "400": { "$ref": "#/components/responses/BadRequest" } } } }, "/servers/{server_id}/votes/top": { "get": { "operationId": "getServerTopVoters", "summary": "Top votanți ai serverului", "description": "Returnează utilizatorii cu cele mai multe voturi.", "security": [], "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "server_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 42 } }, { "$ref": "#/components/parameters/period" }, { "$ref": "#/components/parameters/limit" }, { "$ref": "#/components/parameters/offset" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "response": { "type": "array", "items": { "type": "object", "properties": { "counts": { "type": "object", "properties": { "active": { "type": [ "integer", "string" ] }, "total": { "type": [ "integer", "string" ] } } }, "last": { "type": "object", "properties": { "created_at": { "type": "integer" }, "expire_at": { "type": "integer" }, "nickname": { "type": "string" } } }, "user": { "type": "object", "properties": { "avatar": { "type": [ "string", "null" ] }, "username": { "type": "string" } } } } } } }, "required": [ "response" ] }, "example": { "response": [ { "counts": { "active": 2, "total": 10 }, "last": { "created_at": 1783200000, "expire_at": 1783243200, "nickname": "NovaPlayer" }, "user": { "avatar": "no.jpg", "username": "demo_user" } } ] } } } }, "400": { "$ref": "#/components/responses/BadRequest" } } } }, "/projects/{project_id}/stats/players_online": { "get": { "operationId": "getProjectPlayerStats", "summary": "Graficul numărului de jucători din proiect", "description": "Returnează numărul total minim, mediu și maxim de jucători de pe serverele proiectului pentru fiecare interval.", "security": [], "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "type", "in": "query", "description": "Perioada statisticilor: day, week sau month; implicit month", "schema": { "type": "string", "default": "month", "example": "week", "enum": [ "day", "week", "month" ] } }, { "name": "project_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 1 } } ], "responses": { "200": { "description": "Combined project player statistics grouped by time interval", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProjectPlayerStatsResult" }, "example": { "response": { "items": [ { "avg_players": 12, "date": 1783200000, "max_players": 16, "min_players": 8, "x": 1783200000 } ] } } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "403": { "description": "Private project is not accessible to the requester" }, "404": { "description": "Project not found" } } } }, "/projects/{project_id}/votes": { "get": { "operationId": "getProjectVotes", "summary": "Voturile proiectului", "description": "Returnează voturile pentru proiect. Fără autentificare sunt accesibile doar proiectele publice.", "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "user_id", "in": "query", "description": "Identificatorul utilizatorului", "schema": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, { "name": "project_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 42 } }, { "$ref": "#/components/parameters/limit" }, { "$ref": "#/components/parameters/offset" }, { "$ref": "#/components/parameters/sort" }, { "$ref": "#/components/parameters/order" }, { "$ref": "#/components/parameters/claimed" }, { "$ref": "#/components/parameters/nickname" }, { "$ref": "#/components/parameters/created" }, { "$ref": "#/components/parameters/created__gt" }, { "$ref": "#/components/parameters/created__gte" }, { "$ref": "#/components/parameters/created__lt" }, { "$ref": "#/components/parameters/created__lte" }, { "$ref": "#/components/parameters/expire" }, { "$ref": "#/components/parameters/expire__gt" }, { "$ref": "#/components/parameters/expire__gte" }, { "$ref": "#/components/parameters/expire__lt" }, { "$ref": "#/components/parameters/expire__lte" } ], "security": [], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "response": { "type": "array", "items": { "$ref": "#/components/schemas/VoteDetails" } } }, "required": [ "response" ] }, "example": { "response": [ { "claimed_at": null, "created_at": 1783200000, "entity_id": 42, "entity_type": "project", "expires_at": 1785792000, "id": "7206f073-2f18-4660-91b8-bd947fbc4be2", "nickname": "NovaPlayer", "project": { "id": 42 }, "user": { "avatar": "no.jpg", "id": 204801, "username": "demo_user", "uuid": "d4f9c57e-7c8b-49c7-8d7e-b2f1a39f4a25", "connections": [] } } ] } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "403": { "description": "Private project is not accessible to the requester" }, "404": { "description": "Project not found" }, "503": { "$ref": "#/components/responses/ServiceUnavailable" }, "504": { "$ref": "#/components/responses/QueryTimeout" }, "default": { "$ref": "#/components/responses/UnexpectedError" } } } }, "/projects/{project_id}/votes/chart": { "get": { "operationId": "getProjectVoteChart", "summary": "Graficul voturilor proiectului", "description": "Returnează numărul zilnic de voturi pentru proiect. Fără autentificare sunt accesibile doar proiectele publice.", "security": [], "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "project_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 42 } }, { "$ref": "#/components/parameters/period" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "response": { "type": "array", "items": { "type": "object", "properties": { "x": { "type": [ "integer", "string" ] }, "y": { "type": [ "integer", "string" ] } } } } }, "required": [ "response" ] }, "example": { "response": [ { "x": 1800000000, "y": 10 } ] } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "403": { "description": "Private project is not accessible to the requester" }, "404": { "description": "Project not found" } } } }, "/projects/{project_id}/votes/top": { "get": { "operationId": "getProjectTopVoters", "summary": "Top votanți ai proiectului", "description": "Returnează utilizatorii cu cele mai multe voturi pentru proiect. Fără autentificare sunt accesibile doar proiectele publice.", "security": [], "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "project_id", "in": "path", "required": true, "schema": { "type": "integer", "minimum": 1, "example": 42 } }, { "$ref": "#/components/parameters/period" }, { "$ref": "#/components/parameters/limit" }, { "$ref": "#/components/parameters/offset" } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", "properties": { "response": { "type": "array", "items": { "type": "object", "properties": { "counts": { "type": "object", "properties": { "active": { "type": [ "integer", "string" ] }, "total": { "type": [ "integer", "string" ] } } }, "last": { "type": "object", "properties": { "created_at": { "type": "integer" }, "expire_at": { "type": "integer" }, "nickname": { "type": "string" } } }, "user": { "type": "object", "properties": { "avatar": { "type": [ "string", "null" ] }, "username": { "type": "string" } } } } } } }, "required": [ "response" ] }, "example": { "response": [ { "counts": { "active": 2, "total": 10 }, "last": { "created_at": 1783200000, "expire_at": 1785792000, "nickname": "NovaPlayer" }, "user": { "avatar": "no.jpg", "username": "demo_user" } } ] } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "403": { "description": "Private project is not accessible to the requester" }, "404": { "description": "Project not found" } } } }, "/votes/{vote_id}": { "get": { "operationId": "getVote", "summary": "Vot", "description": "Returnează informații despre un vot după ID.", "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "vote_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 1, "example": "9824cabb-2203-437e-9b6c-aba43dde3e4b" } } ], "responses": { "200": { "description": "Vote details response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoteDetailsEnvelope" }, "example": { "response": { "created_at": 1783200000, "expires_at": 1783243200, "id": "6f59a4a8-2f0f-4d96-a50a-9d7a21f4b812", "entity_id": 100001, "entity_type": "server", "nickname": "NovaPlayer", "server": { "app": { "id": 2400, "name": "Example Shooter", "steam_id": 111111, "url": "example-shooter" }, "game": 111111, "icon": null, "id": 100001, "name": "Example Arena" }, "user": { "avatar": "8f14e45f-e9a1-4f4d-a9f3-6d7b0d4a2c18.webp", "id": 204801, "username": "demo_user", "uuid": "d4f9c57e-7c8b-49c7-8d7e-b2f1a39f4a25", "connections": [ { "id": "100000000000000001", "name": "demo_user", "type": "discord", "url": "https://discord.com/users/100000000000000001" }, { "id": "76561198000000001", "name": "NovaPlayer", "type": "steam", "url": "https://steamcommunity.com/profiles/76561198000000001" } ] }, "claimed_at": null } } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "403": { "$ref": "#/components/responses/Forbidden" }, "404": { "$ref": "#/components/responses/NotFound" }, "503": { "$ref": "#/components/responses/ServiceUnavailable" }, "504": { "$ref": "#/components/responses/QueryTimeout" }, "default": { "$ref": "#/components/responses/UnexpectedError" } }, "security": [] } }, "/votes/{vote_id}/claim": { "post": { "operationId": "claimVote", "summary": "Confirmă procesarea votului", "description": "Marchează votul ca procesat. Disponibil proprietarului serverului sau proiectului.", "security": [ { "AccountAPIKey": [] } ], "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "vote_id", "in": "path", "required": true, "schema": { "type": "string", "minLength": 1, "example": "9824cabb-2203-437e-9b6c-aba43dde3e4b" } } ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/VoteClaimResult" }, "example": { "response": { "success": true } } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "401": { "description": "Missing, invalid, expired or revoked credential." }, "403": { "description": "Missing API key scope, restricted account or entity ownership." }, "404": { "description": "Unknown vote or invalid entity association." }, "429": { "description": "Account claim quota exceeded: 12 000 per minute. Honor Retry-After." } } } }, "/users/{id}": { "get": { "operationId": "getPublicUser", "summary": "Profil de utilizator", "description": "Returnează datele profilului utilizatorului.", "security": [], "parameters": [ { "$ref": "#/components/parameters/ApiVersion" }, { "name": "id", "in": "path", "required": true, "description": "ID-ul contului.", "schema": { "type": "string", "format": "uuid", "example": "ef57cc6f-f068-11ef-a5bf-d00d12c6f2dd" } } ], "responses": { "200": { "description": "User profile.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserProfileResult" }, "example": { "response": { "avatar": "447f9470-325b-4e0a-ada0-f4f1659ef805.png", "id": 1, "username": "GAMEMONITORING", "banner": "469ebf64-206c-4374-a742-7730ea227f95.webp", "connections": [ { "account_id": "76561197960287930", "account_level": 1, "id": 220354, "name": "Rabscuttle", "platform": { "icon": null, "id": 3, "name": "Steam", "url": "steam" } } ], "created": 1435235037, "last_online": 1793734264, "uuid": "ef57cc6f-f068-11ef-a5bf-d00d12c6f2dd" } } } } }, "400": { "$ref": "#/components/responses/BadRequest" }, "404": { "description": "User not found." } } } }, "/users/verify-code": { "post": { "operationId": "verifyUserCode", "summary": "Confirmă titularul contului", "description": "Pentru a confirma că este titularul unui cont GAMEMONITORING, utilizatorul obține un cod din secțiunea „[Integrare](/settings/integration)”. Codul este valabil 5 minute de la emitere. Dacă verificarea reușește, API-ul returnează ID-ul contului pentru care a fost emis codul și marchează codul ca folosit.", "security": [], "parameters": [ { "$ref": "#/components/parameters/ApiVersion" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": false, "required": [ "code" ], "properties": { "code": { "type": "string", "description": "Cod de verificare a contului de unică folosință. Majusculele și minusculele sunt echivalente.", "pattern": "^\\s*[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{4}(?:-[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{4}){2}\\s*$", "example": "7KMD-P9RX-3WHT" } } } } } }, "responses": { "200": { "description": "The stable GAMEMONITORING account ID.", "headers": { "Cache-Control": { "schema": { "type": "string" }, "example": "no-store" } }, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": false, "required": [ "response" ], "properties": { "response": { "type": "object", "additionalProperties": false, "required": [ "id" ], "properties": { "id": { "type": "string", "format": "uuid" } } } } }, "example": { "response": { "id": "550e8400-e29b-41d4-a716-446655440000" } } } } }, "400": { "description": "Invalid request or code format." }, "404": { "description": "Unknown, expired or already redeemed code." }, "429": { "description": "Too many requests." }, "503": { "description": "A required service is temporarily unavailable." } } } } }, "components": { "schemas": { "ErrorEnvelope": { "type": "object", "required": [ "error" ], "properties": { "error": { "type": "object", "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "description": "Codul de stare HTTP." }, "message": { "type": "string", "description": "Mesaj în limba API. Textul poate varia; folosiți codul de stare pentru tratarea erorilor." }, "data": { "description": "Detalii suplimentare despre eroare, dacă sunt disponibile." } } } } }, "Server": { "type": "object", "properties": { "add_date": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ], "description": "Marcaj temporal Unix în secunde (UTC)." }, "app": { "anyOf": [ { "type": "object", "properties": { "id": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "name": { "type": "string" }, "steam_id": { "description": "Steam App ID of the game. Use this as game_steam_id when searching servers.", "anyOf": [ { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "string" } ] }, { "type": "null" } ] }, "url": { "type": "string" } }, "additionalProperties": {} }, { "type": "null" } ] }, "color": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "connect": { "type": [ "string", "null" ] }, "country": { "type": [ "string", "null" ] }, "domain": { "type": [ "string", "null" ] }, "game": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "hide_address": { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, "hide_query": { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, "icon": { "type": [ "string", "null" ] }, "id": { "type": "integer", "minimum": 1, "maximum": 9007199254740991 }, "ip": { "type": [ "string", "null" ] }, "language": { "type": [ "string", "null" ] }, "last_update": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ], "description": "Marcaj temporal Unix în secunde (UTC)." }, "map": { "type": [ "string", "null" ] }, "maxplayers": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "name": { "type": [ "string", "null" ] }, "numplayers": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "official": { "anyOf": [ { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, { "type": "null" } ] }, "points": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "port": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "private": { "anyOf": [ { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, { "type": "null" } ] }, "project_id": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pve": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "pvp": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "query": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "request": { "type": [ "string", "null" ] }, "secured": { "anyOf": [ { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, { "type": "null" } ] }, "status": { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, "steam_id": { "anyOf": [ { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "string" } ] }, { "type": "null" } ], "description": "Păstrați identificatorii text ca text pentru a evita pierderea preciziei." }, "version": { "type": [ "string", "null" ] }, "votes": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "wipe": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ], "description": "Marcaj temporal Unix în secunde (UTC)." }, "ban_reason": { "type": [ "string", "null" ] }, "banned": { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, "boosts": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "bots": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "city": { "type": [ "string", "null" ] }, "description": { "type": [ "string", "null" ], "description": "Descrierea serverului ca listă de blocuri codificată într-un șir JSON." }, "disabled_modules": { "type": "array", "items": { "type": "string" } }, "gamemode": { "type": [ "string", "null" ] }, "hidden": { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, "last_offline": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ], "description": "Marcaj temporal Unix în secunde (UTC)." }, "last_online": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ], "description": "Marcaj temporal Unix în secunde (UTC)." }, "list_hidden": { "anyOf": [ { "type": "boolean" }, { "type": "integer", "minimum": 0, "maximum": 1 } ] }, "map_url": { "type": [ "string", "null" ] }, "mods": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, "name": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": {} } }, "next_wipe": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ], "description": "Marcaj temporal Unix în secunde (UTC)." }, "parked": { "type": "boolean" }, "position_game": { "anyOf": [ { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, { "type": "null" } ] }, "wipe_period": { "type": [ "string", "null" ] } }, "required": [ "id", "parked" ], "additionalProperties": {} }, "ServerEnvelope": { "type": "object", "required": [ "response" ], "properties": { "response": { "$ref": "#/components/schemas/Server", "description": "Răspunsurile reușite conțin rezultatul în response. Listele pot fi tablouri sau obiecte cu items; consultați schema operației." } } }, "UserProfileResult": { "type": "object", "required": [ "response" ], "properties": { "response": { "type": "object", "required": [ "id", "uuid", "username", "avatar", "banner", "created", "last_online" ], "properties": { "id": { "type": "integer", "minimum": 1, "description": "Numeric profile ID." }, "uuid": { "type": "string", "format": "uuid", "description": "Account ID." }, "username": { "type": "string" }, "avatar": { "type": [ "string", "null" ] }, "banner": { "type": [ "string", "null" ] }, "created": { "type": [ "integer", "null" ] }, "last_online": { "type": [ "integer", "null" ] }, "connections": { "type": "array", "items": { "type": "object", "required": [ "id", "account_id", "account_level", "name" ], "properties": { "id": { "type": "integer", "minimum": 1 }, "account_id": { "type": "string" }, "account_level": { "type": [ "number", "null" ] }, "name": { "type": [ "string", "null" ] }, "platform": { "type": [ "object", "null" ], "required": [ "id", "name", "icon", "url" ], "properties": { "id": { "type": "integer", "minimum": 1 }, "name": { "type": "string" }, "icon": { "type": [ "string", "null" ] }, "url": { "type": [ "string", "null" ] } } } } } } } } } }, "ServerCreateResult": { "type": "object", "properties": { "response": { "type": "object", "properties": { "connect": { "type": [ "string", "null" ] }, "game": { "type": [ "integer", "null" ] }, "id": { "type": "integer", "minimum": 1 }, "name": { "type": [ "string", "null" ] }, "request": { "type": [ "string", "null" ] }, "status": { "type": [ "boolean", "null" ] } }, "required": [ "connect", "game", "id", "name", "request", "status" ] } }, "required": [ "response" ] }, "ServerPlayersResult": { "type": "object", "properties": { "response": { "type": "object", "properties": { "items": { "description": "Dacă interogarea istoricului sesiunilor nu găsește jucători, `items` conține lista completă de jucători din ultima interogare a serverului, dacă este disponibilă.", "type": "array", "items": { "type": "object", "properties": { "avatar": { "type": "string" }, "created": { "type": [ "number", "string", "null" ] }, "last_online": { "type": [ "number", "string", "null" ] }, "last_session_time": { "type": "number" }, "name": { "type": [ "number", "string", "null" ] }, "user": { "type": [ "object", "null" ], "properties": { "avatar": { "type": [ "string", "null" ] }, "username": { "type": [ "string", "null" ] } } }, "username": { "type": [ "string", "null" ] } }, "required": [ "avatar", "last_session_time", "username" ] } } }, "required": [ "items" ] } }, "required": [ "response" ] }, "ServerPostsResult": { "type": "object", "properties": { "response": { "type": "array", "items": { "type": "object", "additionalProperties": true } } }, "required": [ "response" ] }, "ServerPlayerStatsResult": { "type": "object", "properties": { "response": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "avg_players": { "type": "number" }, "date": { "type": "number" }, "maps": { "type": "array", "items": { "type": "string" } }, "max_players": { "type": "number" }, "min_players": { "type": "number" }, "x": { "type": "number" }, "y": { "type": "number" } }, "required": [ "avg_players", "date", "maps", "max_players", "min_players", "x", "y" ] } } }, "required": [ "items" ] } }, "required": [ "response" ] }, "ProjectPlayerStatsResult": { "type": "object", "properties": { "response": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", "properties": { "avg_players": { "type": "number" }, "date": { "type": "number" }, "max_players": { "type": "number" }, "min_players": { "type": "number" }, "x": { "type": "number" } }, "required": [ "avg_players", "date", "max_players", "min_players", "x" ] } } }, "required": [ "items" ] } }, "required": [ "response" ] }, "VoteDetailsEnvelope": { "type": "object", "properties": { "response": { "$ref": "#/components/schemas/VoteDetails" } } }, "VoteDetails": { "type": "object", "properties": { "id": { "type": "string", "example": "9824cabb-2203-437e-9b6c-aba43dde3e4b" }, "entity_id": { "type": "number", "description": "ID of the entity that received the vote.", "example": 1 }, "entity_type": { "type": "string", "description": "Type of the entity that received the vote.", "enum": [ "server", "project" ], "example": "server" }, "nickname": { "type": [ "string", "null" ], "example": "PlayerName" }, "created_at": { "type": "number", "example": 1710000000 }, "expires_at": { "type": "number", "example": 1710086400 }, "server": { "type": [ "object", "null" ], "description": "Present for `server` votes.", "properties": { "id": { "type": [ "number", "string", "null" ], "example": 1 }, "name": { "type": [ "string", "null" ], "example": "Public Server" }, "icon": { "type": [ "string", "null" ] }, "game": { "type": [ "number", "null" ], "example": 730 } } }, "project": { "type": [ "object", "null" ], "description": "Present for `project` votes.", "properties": { "id": { "type": "number", "example": 1 } } }, "user": { "type": [ "object", "null" ], "properties": { "id": { "type": [ "number", "string", "null" ] }, "uuid": { "type": [ "string", "null" ] }, "username": { "type": [ "string", "null" ] }, "avatar": { "type": [ "string", "null" ] } } }, "webhook": { "type": [ "object", "null" ], "description": "Present only when the requester can view webhook delivery details.", "properties": { "attempted_at": { "type": [ "number", "null" ] }, "event_id": { "type": [ "string", "null" ] }, "event_type": { "type": [ "string", "null" ], "enum": [ "server.vote", "project.vote", null ], "example": "project.vote" }, "is_test": { "type": [ "boolean", "null" ] }, "request_body": { "type": [ "object", "null" ] }, "response_body": {}, "response_code": { "type": [ "number", "string", "null" ] }, "status": { "type": [ "string", "null" ], "enum": [ "delivered", "failed", "no_result", "pending", null ] }, "url": { "type": [ "string", "null" ] } } }, "claimed_at": { "type": [ "integer", "null" ], "description": "Processing acknowledgement time in Unix seconds; null means unclaimed.", "example": null } } }, "VoteClaimResult": { "type": "object", "properties": { "response": { "type": "object", "properties": { "success": { "type": "boolean", "const": true } }, "required": [ "success" ] } }, "required": [ "response" ] } }, "parameters": { "ApiVersion": { "name": "v", "in": "query", "required": false, "description": "Versiunea API. Omiteți v pentru cea mai mică versiune acceptată. Specificați v=1.0.0 pentru contractul documentat. Valorile invalide, repetate sau neacceptate returnează HTTP 400.", "schema": { "type": "string", "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$", "const": "1.0.0" } }, "created": { "name": "created", "in": "query", "description": "Filtrează după momentul exact al creării votului, în secunde Unix. În lipsa filtrelor de dată, interogarea include toate voturile păstrate.", "schema": { "type": "integer", "example": 1800000000 } }, "created__gt": { "name": "created__gt", "in": "query", "description": "Data creării, secunde Unix >", "schema": { "type": "integer", "example": 1800000000 } }, "created__gte": { "name": "created__gte", "in": "query", "description": "Data creării, secunde Unix ≥", "schema": { "type": "integer", "example": 1800000000 } }, "created__lt": { "name": "created__lt", "in": "query", "description": "Data creării, secunde Unix <", "schema": { "type": "integer", "example": 1800000000 } }, "created__lte": { "name": "created__lte", "in": "query", "description": "Data creării, secunde Unix ≤", "schema": { "type": "integer", "example": 1800000000 } }, "expire": { "name": "expire", "in": "query", "description": "Data expirării, secunde Unix", "schema": { "type": "integer", "example": 1800000000 } }, "expire__gt": { "name": "expire__gt", "in": "query", "description": "Data expirării, secunde Unix >", "schema": { "type": "integer", "example": 1800000000 } }, "expire__gte": { "name": "expire__gte", "in": "query", "description": "Data expirării, secunde Unix ≥", "schema": { "type": "integer", "example": 1800000000 } }, "expire__lt": { "name": "expire__lt", "in": "query", "description": "Data expirării, secunde Unix <", "schema": { "type": "integer", "example": 1800000000 } }, "expire__lte": { "name": "expire__lte", "in": "query", "description": "Data expirării, secunde Unix ≤", "schema": { "type": "integer", "example": 1800000000 } }, "claimed": { "name": "claimed", "in": "query", "description": "Starea procesării: 0 neprocesate, 1 procesate; implicit toate", "schema": { "type": "integer", "enum": [ 0, 1 ], "example": 0 } }, "limit": { "name": "limit", "in": "query", "description": "Număr de elemente de la 1 la 1000, implicit 100", "schema": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 100, "example": 100 } }, "offset": { "name": "offset", "in": "query", "description": "Număr de elemente de omis, minimum 0, implicit 0", "schema": { "type": "integer", "minimum": 0, "default": 0, "example": 0 } }, "order": { "name": "order", "in": "query", "schema": { "type": "string", "enum": [ "asc", "desc" ], "default": "desc", "example": "asc" } }, "sort": { "name": "sort", "in": "query", "schema": { "type": "string", "enum": [ "created", "expire" ], "default": "created", "example": "created" } }, "nickname": { "name": "nickname", "in": "query", "description": "Căutare după fragmente din pseudonimul votantului, de la 3 la 255 de caractere", "schema": { "type": "string", "minLength": 3, "maxLength": 255, "example": "Player" } }, "server_id": { "name": "server_id", "in": "query", "schema": { "type": "integer", "example": 42 } }, "entity_type": { "name": "entity_type", "in": "query", "schema": { "type": "string", "enum": [ "server", "project" ], "example": "server" } }, "webhook_status": { "name": "webhook_status", "in": "query", "schema": { "type": "string", "enum": [ "delivered", "failed", "no_result", "pending" ], "example": "failed" } }, "period": { "name": "period", "in": "query", "description": "Perioadă după data creării votului, implicit întregul istoric păstrat", "schema": { "type": "string", "enum": [ "24h", "7d", "30d", "90d" ], "example": "30d" } } }, "securitySchemes": { "AccountAPIKey": { "type": "http", "scheme": "bearer", "description": "Account API key: 43 base64url characters without a prefix. Claim requires votes:claim scope plus current ownership. Send only in Authorization: Bearer ." } }, "responses": { "BadRequest": { "description": "Parametri sau JSON incorect. Verificați tipurile, câmpurile obligatorii și valorile permise.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEnvelope" }, "example": { "error": { "code": 400, "message": "Invalid request parameters." } } } } }, "Forbidden": { "description": "Acces interzis: adresa este blocată sau proiectul nu este public.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEnvelope" }, "example": { "error": { "code": 403, "message": "Access denied." } } } } }, "ServiceUnavailable": { "description": "Serviciul este temporar indisponibil. Încercați mai târziu.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEnvelope" }, "example": { "error": { "code": 503, "message": "Service temporarily unavailable." } } } } }, "QueryTimeout": { "description": "Interogarea a depășit limita de timp. Încercați mai târziu sau restrângeți cererea.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEnvelope" }, "example": { "error": { "code": 504, "message": "Query timed out." } } } } }, "NotFound": { "description": "Resursa solicitată nu există.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEnvelope" }, "example": { "error": { "code": 404, "message": "Resource not found." } } } } }, "UnexpectedError": { "description": "Eroare neașteptată de server. Obiectul error conține codul de stare real.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorEnvelope" }, "example": { "error": { "code": 500, "message": "Internal server error." } } } } } } }, "servers": [ { "url": "https://api.gamemonitoring.ro" } ] } ``` https://gamemonitoring.ro/developers/docs/api.md --- # GAMEMONITORING MCP MCP (Model Context Protocol) oferă agenților acces la jocuri, servere, starea lor online și numărul de jucători din GAMEMONITORING. Toate instrumentele permit doar citirea. Accesul public este disponibil fără cont sau cheie API. ## Conectează un agent Pentru configurarea manuală, alege Streamable HTTP și lipește adresa URL. Cursor și VS Code permit instalarea directă. Pentru clienții în linie de comandă poți copia comenzile pregătite. ```text https://api.gamemonitoring.net/mcp ``` ### Codex ```bash codex mcp add gamemonitoring --url 'https://api.gamemonitoring.net/mcp' ``` ### Claude Code ```bash claude mcp add --scope user --transport http gamemonitoring 'https://api.gamemonitoring.net/mcp' ``` ### Gemini CLI ```bash gemini mcp add --scope user --transport http gamemonitoring 'https://api.gamemonitoring.net/mcp' ``` ### MCP JSON ```json { "mcpServers": { "gamemonitoring": { "url": "https://api.gamemonitoring.net/mcp" } } } ``` ### Exemplu de cerere pentru un agent ```text Găsește cu GAMEMONITORING cele trei servere Rust cu cei mai mulți jucători online. Afișează adresa și numărul de jucători pentru fiecare server. ``` ## Instrumente MCP Începe cu search_games. Folosește valoarea steam_id returnată ca game_steam_id pentru căutarea, filtrarea și numărarea serverelor. Pentru detalii, folosește ID-ul serverului GAMEMONITORING returnat de search_servers. ### search_games Caută jocuri după nume, slug sau Steam App ID. Returnează steam_id, numele, slugul și numărul de servere și de jucători. ```json { "name": "Rust", "limit": 1 } ``` ### get_server_filters Listează hărți, versiuni, țări, limbi, moduri de joc și alte filtre. Trimite game_steam_id pentru un anumit joc sau un obiect gol pentru filtrele comune. ```json { "game_steam_id": 252490 } ``` ### search_servers Caută servere după joc și filtre. Acceptă sortarea, limit între 1 și 100 și offset. Specifică jocul pentru a restrânge căutarea. ```json { "game_steam_id": 252490, "status": "online", "sort": "numplayers", "limit": 3 } ``` ### get_server Returnează detaliile publice și starea curentă pentru un server_id numeric. ```json { "server_id": 1 } ``` ### get_server_list_metadata Numără toate serverele care corespund filtrelor, serverele online și jucătorii online folosind aceleași filtre ca la căutarea serverelor. ```json { "game_steam_id": 252490, "status": "online" } ``` ## Formatul datelor La un apel tools/call reușit, result.structuredContent conține datele. result.content include o reprezentare textuală și un link către cererea REST sursă. Erorile de protocol apar în câmpul error de la nivelul superior. În cazul unei erori a instrumentului, result.isError este true chiar și cu HTTP 200. Dacă sunt disponibile, detaliile apar în result.structuredContent.error. Dacă expiră timpul de așteptare, restrânge căutarea după joc sau după alte filtre. https://gamemonitoring.ro/developers/docs/mcp.md --- # Webhook {#webhook} Webhook trimite un eveniment GAMEMONITORING către sistemul dvs. după o acțiune pe platformă. Este o cerere obișnuită `POST` cu body JSON, astfel încât site-ul, panoul sau serviciul de joc să poată reacționa automat. Dacă setați recompense pentru voturi, conectați mai întâi Webhook-ul după acest ghid, apoi folosiți fluxul dedicat: [Recompense pentru voturi](https://gamemonitoring.ro/developers/docs/webhook/vote#flow). ## Conectare {#connect} Această configurare leagă un proiect GAMEMONITORING de handlerul dvs. și oferă tokenul de semnare pentru verificarea cererilor primite. 1. Deschideți [Proiectele mele](https://gamemonitoring.ro/projects/my), creați un proiect sau alegeți unul existent, apoi mergeți la setările Webhook. 2. Creați un endpoint HTTPS public care acceptă `POST` cu `Content-Type: application/json` și nu redirecționează cererile. 3. În setările Webhook, introduceți URL-ul complet al handlerului, de exemplu `https://panel.example.com/gamemonitoring-webhook`, și salvați-l. 4. Copiați tokenul de semnare din același bloc și introduceți-l în scriptul handlerului. 5. În handler, verificați `signature`, procesați `event_type` necesar și returnați un răspuns `2xx` reușit doar după procesarea evenimentului. Pentru testare locală, puteți rula handlerul pe computerul dvs. și îl puteți expune printr-un URL HTTPS public. Folosiți [ngrok](https://ngrok.com) sau un alt serviciu de tunelare, apoi introduceți URL-ul public generat în setările Webhook. După configurare, trimiteți un Webhook de test din interfață și verificați statusul livrării. Pentru URL-ul din exemplu, serverul trebuie să accepte `POST` pe `/gamemonitoring-webhook`. Dacă testul eșuează, începeți cu răspunsul handlerului: `401` înseamnă eroare de semnătură, `403` sau o pagină HTML de verificare indică de obicei WAF ori bot protection, iar timeout-ul înseamnă că URL-ul nu este accesibil din internet sau răspunde prea lent. ## Cerințe pentru handler {#handler-requirements} - URL-ul trebuie să fie accesibil din internet. Adresele locale, rețelele private și URL-urile cu login sau parolă nu sunt potrivite. - HTTPS este recomandat pentru producție. HTTP este acceptat, dar protejează mai slab datele în tranzit. - Handlerul trebuie să accepte metoda `POST` și body JSON fără redirectări. - Returnați `2xx` doar după ce sistemul dvs. a procesat evenimentul. De obicei `204 No Content` este suficient. - Dacă evenimentul nu poate fi procesat în siguranță, returnați un cod de eroare. `3xx`, `4xx`, `5xx`, timeout-ul și eroarea de conexiune sunt tratate ca livrare eșuată. - Dacă folosiți firewall, bot protection sau allowlist, adăugați [IP-urile GAMEMONITORING](https://gamemonitoring.ro/developers/docs/ips) în excepții. - Nu returnați în răspuns tokenuri, stack trace, erori SQL sau alte detalii interne. Răspunsul handlerului este afișat în interfață, deci textul erorii trebuie să fie sigur și clar. ## Datele evenimentului {#event-data} Fiecare Webhook vine cu body JSON și câmpuri de bază: - `event_type` — ce eveniment trebuie procesat. - `event_id` — ID-ul unic al evenimentului. Folosiți-l împreună cu `event_type` pentru idempotency și protecție împotriva livrării repetate. - `is_test` — indică o livrare de test din interfață. - `signature` — semnătura body-ului evenimentului. **Exemplu de eveniment Webhook** ```json { "event_id": "9824cabb-2203-437e-9b6c-aba43dde3e4b", "event_type": "example.event", "is_test": false, "signature": "0ac4c97a5d934599dbd78985c4bcbb6926e77b4809d2be56333b1b25f638f064" } ``` Cum citiți exemplul: `event_type` arată ce eveniment trebuie procesat; `event_id` este necesar pentru idempotency înainte de schimbări de stare; `is_test: true` înseamnă o verificare tehnică a livrării; `signature` nu este dată de business și se folosește doar pentru autentificarea cererii. Logica de procesare depinde de `event_type`. Pentru `server.vote` și `project.vote`, folosiți fluxul separat: [Recompense pentru voturi](https://gamemonitoring.ro/developers/docs/webhook/vote#flow). Dacă `is_test` este `true`, verificați semnătura și returnați `2xx`, dar nu modificați balanța, nu acordați obiecte și nu porniți operații de producție. ## Exemplu de răspuns al handlerului {#response-example} Finalizați fiecare eveniment primit cu un singur rezultat clar: - `204 No Content` — semnătura este corectă, iar evenimentul a fost procesat sau omis în siguranță. Returnați același răspuns pentru o livrare de test și pentru un eveniment deja procesat. - `400 Bad Request` — lipsesc câmpuri obligatorii. Aceasta înseamnă o eroare în handler sau un body de cerere neașteptat; nu porniți logica de business. - `401 Unauthorized` — semnătura este invalidă. Nu faceți cereri API, nu modificați baza de date și nu acordați recompense. - `500 Internal Server Error` — baza, coada sau un sistem intern este temporar indisponibil. Livrarea rămâne eșuată și poate fi retrimisă după remedierea cauzei. Exemplu: dacă handlerul a primit evenimentul, a verificat semnătura, a salvat `event_type` + `event_id` și a procesat evenimentul, poate returna `204`. Dacă baza este indisponibilă și evenimentul nu poate fi salvat, este mai bine să returnați `500`, ca livrarea să nu fie marcată prea devreme ca reușită. ## Verificarea semnăturii {#signature} Semnătura se află în câmpul `signature`. Verificați-o înainte de orice logică de business, cereri API și modificări în baza de date. Pentru verificare, luați toate câmpurile body-ului în afară de `signature`, sortați cheile alfabetic și construiți un șir `key=value` unit prin `&`. Valorile boolean se scriu ca `true` sau `false`. **Șir pentru semnătură** ```text event_id=9824cabb-2203-437e-9b6c-aba43dde3e4b&event_type=example.event&is_test=false ``` Pentru exemplul de mai sus, șirul de semnare se construiește doar din `event_id`, `event_type` și `is_test`. Apoi calculați `HMAC-SHA256` cu tokenul de semnare din setările Webhook și comparați rezultatul cu `signature` din cerere. Semnăturile precalculate din exemple folosesc tokenul demonstrativ `paste-webhook-token-here`. În handlerul dvs., folosiți tokenul din setările Webhook. În handlerul dvs.: - construiți șirul pentru semnătură din chei sortate; - calculați `HMAC-SHA256` cu tokenul de semnare; - comparați rezultatul cu `signature` folosind o funcție cu timp constant de comparare: `hash_equals` în PHP, `timingSafeEqual` în Node.js sau `compare_digest` în Python; - returnați `401` dacă semnătura este invalidă. ## Pasul 1. Handler de bază {#minimal-handler} Începeți cu un handler care poate primi orice Webhook: citește JSON, verifică `signature`, procesează livrarea de test, verifică câmpurile de bază și returnează `204`. În acest pas, handlerul doar confirmă că livrarea este acceptată corect. Adăugați logica specifică evenimentului după ce acest flux de bază funcționează. ### PHP ```php $isTest ? 'true' : 'false']); // Build the exact signing string: all body fields except signature, // sorted by key and joined as key=value pairs with &. $fields = array_values(array_filter(array_keys($event), fn($field) => $field !== 'signature')); sort($fields, SORT_STRING); // Calculate HMAC-SHA256 with the webhook token from your settings. $signing = implode('&', array_map(fn($field) => $field . '=' . (string) ($signingData[$field] ?? ''), $fields)); $expected = hash_hmac('sha256', $signing, $secret); $actual = (string) ($event['signature'] ?? ''); // Reject the request before doing any work when the signature is invalid. if (!hash_equals($expected, $actual)) { http_response_code(401); exit; } // Test deliveries must not change balance, inventory, roles, or production data. if ($isTest) { http_response_code(204); exit; } // Real deliveries must include an event type and a stable event id. $eventType = (string) ($event['event_type'] ?? ''); $eventId = (string) ($event['event_id'] ?? ''); if ($eventType === '' || $eventId === '') { http_response_code(400); exit; } // At this point the webhook is trusted. Add event-specific logic here. syslog(LOG_INFO, 'Accepted webhook event ' . $eventType . ' #' . $eventId); // 204 tells GAMEMONITORING that the delivery was accepted successfully. http_response_code(204); ``` ### JavaScript ```javascript const crypto = require('node:crypto') const express = require('express') const app = express() // Replace this token with the signing token from your GAMEMONITORING webhook settings. const secret = 'paste-webhook-token-here' // GAMEMONITORING sends JSON with Content-Type: application/json. app.use(express.json()) function isValidSignature(event) { // Build the exact signing string: all body fields except signature, // sorted by key and joined as key=value pairs with &. const fields = Object.keys(event).filter((field) => field !== 'signature').sort() const signing = fields.map((field) => field + '=' + String(event[field] ?? '')).join('&') // Calculate HMAC-SHA256 with the webhook token from your settings. const expected = crypto.createHmac('sha256', secret).update(signing).digest('hex') const actual = String(event.signature || '') // timingSafeEqual requires buffers with the same length. const expectedBuffer = Buffer.from(expected) const actualBuffer = Buffer.from(actual) return expectedBuffer.length === actualBuffer.length && crypto.timingSafeEqual(expectedBuffer, actualBuffer) } app.post('/gamemonitoring-webhook', (req, res) => { // Read the webhook payload parsed by express.json(). const event = req.body || {} // Reject the request before doing any work when the signature is invalid. if (!isValidSignature(event)) { return res.sendStatus(401) } // Test deliveries must not change balance, inventory, roles, or production data. if (event.is_test === true) { return res.sendStatus(204) } // Real deliveries must include an event type and a stable event id. const eventType = String(event.event_type || '') const eventId = String(event.event_id || '') if (!eventType || !eventId) { return res.sendStatus(400) } // At this point the webhook is trusted. Add event-specific logic here. console.log('Accepted webhook event ' + eventType + ' #' + eventId) // 204 tells GAMEMONITORING that the delivery was accepted successfully. return res.sendStatus(204) }) app.listen(3000) ``` ### Python ```python import hashlib import hmac from flask import Flask, abort, request app = Flask(__name__) # Replace this token with the signing token from your GAMEMONITORING webhook settings. secret = b'paste-webhook-token-here' def stringify(value): # GAMEMONITORING signs booleans as lowercase true/false strings. if isinstance(value, bool): return 'true' if value else 'false' return '' if value is None else str(value) def is_valid_signature(event): # Build the exact signing string: all body fields except signature, # sorted by key and joined as key=value pairs with &. fields = sorted(field for field in event.keys() if field != 'signature') signing = '&'.join(f'{field}={stringify(event.get(field))}' for field in fields) # Calculate HMAC-SHA256 with the webhook token from your settings. expected = hmac.new(secret, signing.encode(), hashlib.sha256).hexdigest() actual = str(event.get('signature') or '') return hmac.compare_digest(expected, actual) @app.post('/gamemonitoring-webhook') def gamemonitoring_webhook(): # Read and decode the JSON body sent by GAMEMONITORING. event = request.get_json(silent=True) or {} # Reject the request before doing any work when the signature is invalid. if not is_valid_signature(event): abort(401) # Test deliveries must not change balance, inventory, roles, or production data. if event.get('is_test') is True: return '', 204 # Real deliveries must include an event type and a stable event id. event_type = str(event.get('event_type') or '') event_id = str(event.get('event_id') or '') if not event_type or not event_id: abort(400) # At this point the webhook is trusted. Add event-specific logic here. app.logger.info('Accepted webhook event %s #%s', event_type, event_id) # 204 tells GAMEMONITORING that the delivery was accepted successfully. return '', 204 ``` ## Pasul 2. Adăugați deduplicarea {#deduplication} Webhook folosește modelul at-least-once: același eveniment poate ajunge de mai multe ori. Înainte ca handlerul să schimbe starea sistemului dvs., faceți operația idempotentă pe baza `event_type` + `event_id`. Creați mai întâi un tabel care salvează perechea `event_type` și `event_id` cu cheie unică. Dacă înregistrarea există deja, evenimentul a fost procesat. **Tabel cu evenimente Webhook procesate** ```sql CREATE TABLE gamemonitoring_webhooks ( event_type varchar(64) NOT NULL, event_id varchar(100) NOT NULL, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (event_type, event_id) ); ``` Apoi extindeți handlerul de bază: după verificarea semnăturii și a câmpurilor de bază, salvați `event_type` + `event_id` și executați schimbările de stare în aceeași tranzacție. ### PHP ```php $isTest ? 'true' : 'false']); // Build the exact signing string: all body fields except signature, // sorted by key and joined as key=value pairs with &. $fields = array_values(array_filter(array_keys($event), fn($field) => $field !== 'signature')); sort($fields, SORT_STRING); // Calculate HMAC-SHA256 with the webhook token from your settings. $signing = implode('&', array_map(fn($field) => $field . '=' . (string) ($signingData[$field] ?? ''), $fields)); $expected = hash_hmac('sha256', $signing, $secret); $actual = (string) ($event['signature'] ?? ''); // Reject the request before doing any work when the signature is invalid. if (!hash_equals($expected, $actual)) { http_response_code(401); exit; } // Test deliveries must not change balance, inventory, roles, or production data. if ($isTest) { http_response_code(204); exit; } // Real deliveries must include an event type and a stable event id. $eventType = (string) ($event['event_type'] ?? ''); $eventId = (string) ($event['event_id'] ?? ''); if ($eventType === '' || $eventId === '') { http_response_code(400); exit; } // At this point the webhook is trusted. Deduplicate it before event-specific logic. $pdo = null; try { // Add your local database connection for deduplication and event-specific work. $pdo = new PDO('mysql:host=127.0.0.1;dbname=game;charset=utf8mb4', 'game', 'password', [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ]); // Keep deduplication and the real state change in one transaction. // If any step fails, return 500 so the delivery can be retried. $pdo->beginTransaction(); // Store the event once. This requires the table to have a unique key on // (event_type, event_id). Duplicate deliveries affect zero rows. $deduplicate = $pdo->prepare('INSERT IGNORE INTO gamemonitoring_webhooks (event_type, event_id) VALUES (?, ?)'); $deduplicate->execute([$eventType, $eventId]); // The event was already processed earlier. Return success without changing // state again, because duplicate delivery is expected. if ($deduplicate->rowCount() === 0) { $pdo->commit(); http_response_code(204); exit; } // Add event-specific database changes here. Keep them after the // deduplication insert and inside this same transaction. // Commit only after deduplication and event-specific work both succeed. $pdo->commit(); // Log only newly processed real events after the transaction succeeds. syslog(LOG_INFO, 'Accepted webhook event ' . $eventType . ' #' . $eventId); http_response_code(204); } catch (Throwable $error) { // Roll back partial database work so the event can be retried safely. if ($pdo instanceof PDO && $pdo->inTransaction()) { $pdo->rollBack(); } // 500 keeps the delivery failed instead of marking unfinished work as done. http_response_code(500); } ``` ### JavaScript ```javascript const crypto = require('node:crypto') const express = require('express') const mysql = require('mysql2/promise') const app = express() // Replace this token with the signing token from your GAMEMONITORING webhook settings. const secret = 'paste-webhook-token-here' // Add your local database connection for deduplication and event-specific work. const db = mysql.createPool({ database: 'game', host: '127.0.0.1', password: 'password', user: 'game', }) // GAMEMONITORING sends JSON with Content-Type: application/json. app.use(express.json()) function isValidSignature(event) { // Build the exact signing string: all body fields except signature, // sorted by key and joined as key=value pairs with &. const fields = Object.keys(event).filter((field) => field !== 'signature').sort() const signing = fields.map((field) => field + '=' + String(event[field] ?? '')).join('&') // Calculate HMAC-SHA256 with the webhook token from your settings. const expected = crypto.createHmac('sha256', secret).update(signing).digest('hex') const actual = String(event.signature || '') // timingSafeEqual requires buffers with the same length. const expectedBuffer = Buffer.from(expected) const actualBuffer = Buffer.from(actual) return expectedBuffer.length === actualBuffer.length && crypto.timingSafeEqual(expectedBuffer, actualBuffer) } app.post('/gamemonitoring-webhook', async (req, res) => { // Read the webhook payload parsed by express.json(). const event = req.body || {} // Reject the request before doing any work when the signature is invalid. if (!isValidSignature(event)) { return res.sendStatus(401) } // Test deliveries must not change balance, inventory, roles, or production data. if (event.is_test === true) { return res.sendStatus(204) } // Real deliveries must include an event type and a stable event id. const eventType = String(event.event_type || '') const eventId = String(event.event_id || '') if (!eventType || !eventId) { return res.sendStatus(400) } // At this point the webhook is trusted. Deduplicate it before event-specific logic. let connection try { connection = await db.getConnection() // Keep deduplication and the real state change in one transaction. // If any step fails, return 500 so the delivery can be retried. await connection.beginTransaction() // Store the event once. This requires the table to have a unique key on // (event_type, event_id). Duplicate deliveries affect zero rows. const [deduplicate] = await connection.execute( 'INSERT IGNORE INTO gamemonitoring_webhooks (event_type, event_id) VALUES (?, ?)', [eventType, eventId], ) // The event was already processed earlier. Return success without changing // state again, because duplicate delivery is expected. if (deduplicate.affectedRows === 0) { await connection.commit() return res.sendStatus(204) } // Add event-specific database changes here. Keep them after the // deduplication insert and inside this same transaction. // Commit only after deduplication and event-specific work both succeed. await connection.commit() // Log only newly processed real events after the transaction succeeds. console.log('Accepted webhook event ' + eventType + ' #' + eventId) return res.sendStatus(204) } catch (error) { // Roll back partial database work so the event can be retried safely. if (connection) { await connection.rollback() } // 500 keeps the delivery failed instead of marking unfinished work as done. return res.sendStatus(500) } finally { // Return the connection to the pool. if (connection) { connection.release() } } }) app.listen(3000) ``` ### Python ```python import hashlib import hmac import pymysql from flask import Flask, abort, request app = Flask(__name__) # Replace this token with the signing token from your GAMEMONITORING webhook settings. secret = b'paste-webhook-token-here' # Add your local database connection for deduplication and event-specific work. db_config = { 'database': 'game', 'host': '127.0.0.1', 'password': 'password', 'user': 'game', } def stringify(value): # GAMEMONITORING signs booleans as lowercase true/false strings. if isinstance(value, bool): return 'true' if value else 'false' return '' if value is None else str(value) def is_valid_signature(event): # Build the exact signing string: all body fields except signature, # sorted by key and joined as key=value pairs with &. fields = sorted(field for field in event.keys() if field != 'signature') signing = '&'.join(f'{field}={stringify(event.get(field))}' for field in fields) # Calculate HMAC-SHA256 with the webhook token from your settings. expected = hmac.new(secret, signing.encode(), hashlib.sha256).hexdigest() actual = str(event.get('signature') or '') return hmac.compare_digest(expected, actual) @app.post('/gamemonitoring-webhook') def gamemonitoring_webhook(): # Read and decode the JSON body sent by GAMEMONITORING. event = request.get_json(silent=True) or {} # Reject the request before doing any work when the signature is invalid. if not is_valid_signature(event): abort(401) # Test deliveries must not change balance, inventory, roles, or production data. if event.get('is_test') is True: return '', 204 # Real deliveries must include an event type and a stable event id. event_type = str(event.get('event_type') or '') event_id = str(event.get('event_id') or '') if not event_type or not event_id: abort(400) # At this point the webhook is trusted. Deduplicate it before event-specific logic. connection = None try: connection = pymysql.connect(**db_config) connection.begin() # Keep deduplication and the real state change in one transaction. # If any step fails, return 500 so the delivery can be retried. with connection.cursor() as cursor: # Store the event once. This requires the table to have a unique key # on (event_type, event_id). Duplicate deliveries affect zero rows. cursor.execute( 'INSERT IGNORE INTO gamemonitoring_webhooks (event_type, event_id) VALUES (%s, %s)', (event_type, event_id), ) # The event was already processed earlier. Return success without # changing state again, because duplicate delivery is expected. if cursor.rowcount == 0: connection.commit() return '', 204 # Add event-specific database changes here. Keep them after the # deduplication insert and inside this same transaction. # Commit only after deduplication and event-specific work both succeed. connection.commit() # Log only newly processed real events after the transaction succeeds. app.logger.info('Accepted webhook event %s #%s', event_type, event_id) return '', 204 except Exception: # Roll back partial database work so the event can be retried safely. if connection: connection.rollback() # 500 keeps the delivery failed instead of marking unfinished work as done. abort(500) finally: # Close the database connection. if connection: connection.close() ``` Nu folosiți nickname-ul, ID-ul utilizatorului sau ID-ul serverului ca cheie de deduplicare: un utilizator poate declanșa evenimente diferite sau poate repeta mai târziu o acțiune permisă. Cheia trebuie să fie `event_type` + `event_id`. Exemplu: handlerul a schimbat starea sistemului dvs., dar conexiunea s-a întrerupt înainte ca GAMEMONITORING să primească `204`. Mai târziu livrarea este retrimisă și același eveniment sosește din nou. Handlerul trebuie să găsească `event_type` + `event_id` salvate, să sară schimbarea de stare repetată și să returneze `204`. Dacă handlerul nu poate procesa temporar evenimentul, returnați un răspuns cu eroare. După remedierea cauzei, livrarea poate fi retrimisă din interfață, dacă retrimiterea este disponibilă pentru acel eveniment. ## Teste și retrimitere {#tests-resend} O livrare de test (`is_test: true`) verifică URL-ul, semnătura și răspunsul HTTP al handlerului. Handlerul trebuie să treacă prin același flux de procesare: citește JSON, verifică `signature`, recunoaște `is_test` și returnează un răspuns `2xx` reușit. Un eveniment de test nu trebuie să modifice balanța, inventarul, rolurile, abonamentele sau alte date de producție. Pentru test sunt suficiente un log tehnic și răspunsul `204`. Dacă livrarea eșuează, interfața arată statusul, codul HTTP și răspunsul handlerului. După remedierea cauzei, livrarea eșuată poate fi retrimisă dacă retrimiterea este disponibilă pentru acel eveniment. https://gamemonitoring.ro/developers/docs/webhook.md --- # Recompense pentru voturi {#vote-rewards} Recompensele pentru voturi folosesc evenimentele Webhook `server.vote` și `project.vote`: handlerul primește evenimentul, obține datele votului prin API și acordă recompensa o singură dată. Configurați mai întâi [Webhook-ul proiectului](https://gamemonitoring.ro/developers/docs/webhook#connect) și verificarea [signature](https://gamemonitoring.ro/developers/docs/webhook#signature). Datele votului sunt cerute prin [GET /votes/:vote_id](https://gamemonitoring.ro/developers/docs/api/votes/:vote_id/__GET). ## Cum funcționează scenariul {#flow} 1. Primiți evenimentul Webhook și verificați [signature](https://gamemonitoring.ro/developers/docs/webhook#signature). Dacă [is_test](https://gamemonitoring.ro/developers/docs/webhook#tests-resend) este `true`, returnați `204` fără să cereți votul și fără să acordați recompensa. 2. Asigurați-vă că `event_type` este `server.vote` sau `project.vote`. 3. Folosiți `event_id` ca ID al votului. 4. Obțineți datele votului prin [GET /votes/:vote_id](https://gamemonitoring.ro/developers/docs/api/votes/:vote_id/__GET) și găsiți jucătorul în sistemul dvs. 5. Într-o singură tranzacție, aplicați [protecția împotriva procesării repetate](https://gamemonitoring.ro/developers/docs/webhook#deduplication) după `event_type` + `event_id` și acordați recompensa doar pentru un eveniment nou. 6. Dacă recompensa nu poate fi acordată în siguranță, returnați un răspuns cu eroare. După remedierea cauzei, [trimiteți din nou livrarea](https://gamemonitoring.ro/developers/docs/webhook#tests-resend) din interfață. ## Exemplu de recompensă {#reward-example} Să presupunem că jucătorul `PlayerName` a votat pentru serverul cu ID `1`, iar sistemul dvs. trebuie să îi adauge `100` monede. 1. GAMEMONITORING trimite un Webhook cu `event_type: server.vote` și `event_id: 9824cabb-2203-437e-9b6c-aba43dde3e4b`. 2. Handlerul verifică [signature](https://gamemonitoring.ro/developers/docs/webhook#signature). Dacă semnătura este invalidă, returnează `401` și se oprește. 3. Handlerul cere `GET /votes/9824cabb-2203-437e-9b6c-aba43dde3e4b`, primește nickname, server și utilizator, apoi găsește contul local. 4. Într-o tranzacție, handlerul salvează `event_type` + `event_id` pentru [protecția împotriva procesării repetate](https://gamemonitoring.ro/developers/docs/webhook#deduplication). 5. Pentru un eveniment nou, handlerul adaugă `100` monede în aceeași tranzacție. 6. La o livrare repetată, handlerul găsește evenimentul deja salvat, nu acordă recompensa din nou și returnează `204`. Același scenariu este potrivit și pentru obiecte, roluri, timp VIP, coduri promoționale sau sarcini într-o coadă internă. ## Evenimentul de vot {#vote-event} Pentru un vot de server, GAMEMONITORING trimite `server.vote`, iar pentru un vot de proiect — `project.vote`. Body-ul evenimentului conține doar date de livrare: `event_type`, `event_id`, `is_test` și `signature`. Datele complete ale votului trebuie cerute separat. **Exemplu de eveniment** ```json { "event_id": "9824cabb-2203-437e-9b6c-aba43dde3e4b", "event_type": "server.vote", "is_test": false, "signature": "ae83b8aba88a3a9ab3b97b1f6d65664da5628a9cb64d56d5132807bca5472e4f" } ``` În acest eveniment, `event_id` este ID-ul votului. Nu folosiți body-ul Webhook ca sursă pentru nickname, server sau utilizator: aceste date vin din API. ## Obținerea datelor votului {#fetch-vote} Folosiți `event_id` ca `vote_id` și cereți datele votului prin [GET /votes/:vote_id](https://gamemonitoring.ro/developers/docs/api/votes/:vote_id/__GET): **Cerere pentru datele votului** ```bash curl -sS "https://api.gamemonitoring.ro/votes/9824cabb-2203-437e-9b6c-aba43dde3e4b" ``` Pentru acordarea recompensei, de obicei aveți nevoie de `response.nickname`, `response.server` și datele publice `response.user`. Dacă recompensa depinde de un anumit server, verificați întotdeauna `response.server.id`. Cum se folosesc câmpurile: `response.nickname` ajută la găsirea contului jucătorului în baza dvs., `response.server.id` alege regula de recompensă pentru server, iar `response.user.id` poate fi salvat în logul recompenselor ca ID al utilizatorului GAMEMONITORING care a votat. Dacă API-ul este temporar indisponibil sau returnează un răspuns neașteptat, nu acordați recompensa fără verificare. Returnați un cod de eroare, remediați cauza și [trimiteți din nou livrarea](https://gamemonitoring.ro/developers/docs/webhook#tests-resend) din interfață. ## Pasul 3. Handler pentru recompensa după vot {#complete-example} Exemplul continuă handlerul de bază: verifică semnătura, obține datele votului, protejează evenimentul de procesare repetată și acordă recompensa într-o singură tranzacție. Înlocuiți numele tabelului de utilizatori, câmpul de balanță și regula de căutare a jucătorului cu structura sistemului dvs. Înainte de rularea exemplului, configurați [Webhook-ul proiectului](https://gamemonitoring.ro/developers/docs/webhook#connect), verificați [GET /votes/:vote_id](https://gamemonitoring.ro/developers/docs/api/votes/:vote_id/__GET) și înlocuiți actualizările SQL pentru utilizator cu modelul dvs. de conturi. ### PHP ```php $isTest ? 'true' : 'false']); // Build the exact signing string: all body fields except signature, // sorted by key and joined as key=value pairs with &. $fields = array_values(array_filter(array_keys($event), fn($field) => $field !== 'signature')); sort($fields, SORT_STRING); // Calculate HMAC-SHA256 with the webhook token from your settings. $signing = implode('&', array_map(fn($field) => $field . '=' . (string) ($signingData[$field] ?? ''), $fields)); $expected = hash_hmac('sha256', $signing, $secret); $actual = (string) ($event['signature'] ?? ''); // Reject the request before doing any work when the signature is invalid. if (!hash_equals($expected, $actual)) { http_response_code(401); exit; } // Test deliveries must not change balance, inventory, roles, or production data. if ($isTest) { http_response_code(204); exit; } // Real deliveries must include an event type and a stable event id. $eventType = (string) ($event['event_type'] ?? ''); $eventId = (string) ($event['event_id'] ?? ''); if ($eventType === '' || $eventId === '') { http_response_code(400); exit; } // This reward handler processes server and project vote events. if (!in_array($eventType, ['server.vote', 'project.vote'], true)) { http_response_code(204); exit; } // At this point the webhook is trusted. Load vote data before opening a database transaction. $pdo = null; try { // Load full vote data by event_id. Nickname, entity, and user data are not // in the webhook body. Return 500 if the API cannot confirm the vote. $voteUrl = $apiUrl . '/votes/' . rawurlencode($eventId); $voteContext = stream_context_create(['http' => ['timeout' => 5]]); $voteBody = @file_get_contents($voteUrl, false, $voteContext); if ($voteBody === false) { throw new RuntimeException('Vote API request failed'); } $voteResponse = json_decode($voteBody, true) ?: []; $vote = $voteResponse['response'] ?? null; // Do not issue a reward when the vote response is missing a concrete nickname. if (!is_array($vote) || !isset($vote['nickname']) || !is_string($vote['nickname'])) { throw new RuntimeException('Vote API response does not include nickname'); } // Verify that the API entity matches the event before changing the account. $expectedEntityType = $eventType === 'project.vote' ? 'project' : 'server'; if (($vote['entity_type'] ?? '') !== $expectedEntityType) { throw new RuntimeException('Vote entity type does not match event type'); } // Use vote nickname to update the local account. The entity id is available in // vote.entity_id and in either vote.server.id or vote.project.id. $nickname = trim($vote['nickname']); if ($nickname === '') { throw new RuntimeException('Vote nickname is empty'); } // Add your local database connection for deduplication and event-specific work. $pdo = new PDO('mysql:host=127.0.0.1;dbname=game;charset=utf8mb4', 'game', 'password', [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, ]); // Keep deduplication and the real state change in one transaction. // If any step fails, return 500 so the delivery can be retried. $pdo->beginTransaction(); // Store the event once. This requires the table to have a unique key on // (event_type, event_id). Duplicate deliveries affect zero rows. $deduplicate = $pdo->prepare('INSERT IGNORE INTO gamemonitoring_webhooks (event_type, event_id) VALUES (?, ?)'); $deduplicate->execute([$eventType, $eventId]); // The event was already processed earlier. Return success without changing // state again, because duplicate delivery is expected. if ($deduplicate->rowCount() === 0) { $pdo->commit(); http_response_code(204); exit; } // Add event-specific database changes here. Keep them after the // deduplication insert and inside this same transaction. $balance = $pdo->prepare('UPDATE users SET balance = balance + ? WHERE nickname = ?'); $balance->execute([$rewardAmount, $nickname]); // Commit only after deduplication and event-specific work both succeed. $pdo->commit(); // Log only newly processed real events after the transaction succeeds. syslog(LOG_INFO, 'Accepted webhook event ' . $eventType . ' #' . $eventId); http_response_code(204); } catch (Throwable $error) { // Roll back partial database work so the event can be retried safely. if ($pdo instanceof PDO && $pdo->inTransaction()) { $pdo->rollBack(); } // 500 keeps the delivery failed instead of marking unfinished work as done. http_response_code(500); } ``` ### JavaScript ```javascript const crypto = require('node:crypto') const express = require('express') const mysql = require('mysql2/promise') const app = express() // Replace this token with the signing token from your GAMEMONITORING webhook settings. const secret = 'paste-webhook-token-here' // Add the GAMEMONITORING API URL and reward settings for vote events. const apiUrl = 'https://api.gamemonitoring.ro' const rewardAmount = '1.00' // Add your local database connection for deduplication and event-specific work. const db = mysql.createPool({ database: 'game', host: '127.0.0.1', password: 'password', user: 'game', }) // GAMEMONITORING sends JSON with Content-Type: application/json. app.use(express.json()) function isValidSignature(event) { // Build the exact signing string: all body fields except signature, // sorted by key and joined as key=value pairs with &. const fields = Object.keys(event).filter((field) => field !== 'signature').sort() const signing = fields.map((field) => field + '=' + String(event[field] ?? '')).join('&') // Calculate HMAC-SHA256 with the webhook token from your settings. const expected = crypto.createHmac('sha256', secret).update(signing).digest('hex') const actual = String(event.signature || '') // timingSafeEqual requires buffers with the same length. const expectedBuffer = Buffer.from(expected) const actualBuffer = Buffer.from(actual) return expectedBuffer.length === actualBuffer.length && crypto.timingSafeEqual(expectedBuffer, actualBuffer) } app.post('/gamemonitoring-webhook', async (req, res) => { // Read the webhook payload parsed by express.json(). const event = req.body || {} // Reject the request before doing any work when the signature is invalid. if (!isValidSignature(event)) { return res.sendStatus(401) } // Test deliveries must not change balance, inventory, roles, or production data. if (event.is_test === true) { return res.sendStatus(204) } // Real deliveries must include an event type and a stable event id. const eventType = String(event.event_type || '') const eventId = String(event.event_id || '') if (!eventType || !eventId) { return res.sendStatus(400) } // This reward handler processes server and project vote events. if (!['server.vote', 'project.vote'].includes(eventType)) { return res.sendStatus(204) } // At this point the webhook is trusted. Load vote data before opening a database transaction. let connection try { // Load full vote data by event_id. Nickname, entity, and user data are not // in the webhook body. Return 500 if the API cannot confirm the vote. const voteUrl = apiUrl + '/votes/' + encodeURIComponent(eventId) const voteResponse = await fetch(voteUrl, { signal: AbortSignal.timeout(5000) }) if (!voteResponse.ok) { throw new Error('Vote API request failed') } const voteBody = await voteResponse.json() const vote = voteBody.response // Do not issue a reward when the vote response is missing a concrete nickname. if (!vote || typeof vote.nickname !== 'string') { throw new Error('Vote API response does not include nickname') } // Verify that the API entity matches the event before changing the account. const expectedEntityType = eventType === 'project.vote' ? 'project' : 'server' if (vote.entity_type !== expectedEntityType) { throw new Error('Vote entity type does not match event type') } // Use vote nickname to update the local account. The entity id is available in // vote.entity_id and in either vote.server.id or vote.project.id. const nickname = vote.nickname.trim() if (!nickname) { throw new Error('Vote nickname is empty') } connection = await db.getConnection() // Keep deduplication and the real state change in one transaction. // If any step fails, return 500 so the delivery can be retried. await connection.beginTransaction() // Store the event once. This requires the table to have a unique key on // (event_type, event_id). Duplicate deliveries affect zero rows. const [deduplicate] = await connection.execute( 'INSERT IGNORE INTO gamemonitoring_webhooks (event_type, event_id) VALUES (?, ?)', [eventType, eventId], ) // The event was already processed earlier. Return success without changing // state again, because duplicate delivery is expected. if (deduplicate.affectedRows === 0) { await connection.commit() return res.sendStatus(204) } // Add event-specific database changes here. Keep them after the // deduplication insert and inside this same transaction. await connection.execute('UPDATE users SET balance = balance + ? WHERE nickname = ?', [rewardAmount, nickname]) // Commit only after deduplication and event-specific work both succeed. await connection.commit() // Log only newly processed real events after the transaction succeeds. console.log('Accepted webhook event ' + eventType + ' #' + eventId) return res.sendStatus(204) } catch (error) { // Roll back partial database work so the event can be retried safely. if (connection) { await connection.rollback() } // 500 keeps the delivery failed instead of marking unfinished work as done. return res.sendStatus(500) } finally { // Return the connection to the pool. if (connection) { connection.release() } } }) app.listen(3000) ``` ### Python ```python import hashlib import hmac import pymysql import requests from flask import Flask, abort, request app = Flask(__name__) # Replace this token with the signing token from your GAMEMONITORING webhook settings. secret = b'paste-webhook-token-here' # Add the GAMEMONITORING API URL and reward settings for vote events. api_url = 'https://api.gamemonitoring.ro' reward_amount = '1.00' # Add your local database connection for deduplication and event-specific work. db_config = { 'database': 'game', 'host': '127.0.0.1', 'password': 'password', 'user': 'game', } def stringify(value): # GAMEMONITORING signs booleans as lowercase true/false strings. if isinstance(value, bool): return 'true' if value else 'false' return '' if value is None else str(value) def is_valid_signature(event): # Build the exact signing string: all body fields except signature, # sorted by key and joined as key=value pairs with &. fields = sorted(field for field in event.keys() if field != 'signature') signing = '&'.join(f'{field}={stringify(event.get(field))}' for field in fields) # Calculate HMAC-SHA256 with the webhook token from your settings. expected = hmac.new(secret, signing.encode(), hashlib.sha256).hexdigest() actual = str(event.get('signature') or '') return hmac.compare_digest(expected, actual) @app.post('/gamemonitoring-webhook') def gamemonitoring_webhook(): # Read and decode the JSON body sent by GAMEMONITORING. event = request.get_json(silent=True) or {} # Reject the request before doing any work when the signature is invalid. if not is_valid_signature(event): abort(401) # Test deliveries must not change balance, inventory, roles, or production data. if event.get('is_test') is True: return '', 204 # Real deliveries must include an event type and a stable event id. event_type = str(event.get('event_type') or '') event_id = str(event.get('event_id') or '') if not event_type or not event_id: abort(400) # This reward handler processes server and project vote events. if event_type not in ('server.vote', 'project.vote'): return '', 204 # At this point the webhook is trusted. Load vote data before opening a database transaction. connection = None try: # Load full vote data by event_id. Nickname, entity, and user data # are not in the webhook body. Return 500 if the API cannot confirm the vote. vote_url = f"{api_url}/votes/{event_id}" response = requests.get(vote_url, timeout=5) if not response.ok: raise RuntimeError('Vote API request failed') vote = response.json().get('response') # Do not issue a reward when the vote response is missing a concrete nickname. if not isinstance(vote, dict) or not isinstance(vote.get('nickname'), str): raise RuntimeError('Vote API response does not include nickname') # Verify that the API entity matches the event before changing the account. expected_entity_type = 'project' if event_type == 'project.vote' else 'server' if vote.get('entity_type') != expected_entity_type: raise RuntimeError('Vote entity type does not match event type') # Use vote nickname to update the local account. The entity id is available in # vote.entity_id and in either vote.server.id or vote.project.id. nickname = vote['nickname'].strip() if not nickname: raise RuntimeError('Vote nickname is empty') connection = pymysql.connect(**db_config) connection.begin() # Keep deduplication and the real state change in one transaction. # If any step fails, return 500 so the delivery can be retried. with connection.cursor() as cursor: # Store the event once. This requires the table to have a unique key # on (event_type, event_id). Duplicate deliveries affect zero rows. cursor.execute( 'INSERT IGNORE INTO gamemonitoring_webhooks (event_type, event_id) VALUES (%s, %s)', (event_type, event_id), ) # The event was already processed earlier. Return success without # changing state again, because duplicate delivery is expected. if cursor.rowcount == 0: connection.commit() return '', 204 # Add event-specific database changes here. Keep them after the # deduplication insert and inside this same transaction. cursor.execute('UPDATE users SET balance = balance + %s WHERE nickname = %s', (reward_amount, nickname)) # Commit only after deduplication and event-specific work both succeed. connection.commit() # Log only newly processed real events after the transaction succeeds. app.logger.info('Accepted webhook event %s #%s', event_type, event_id) return '', 204 except Exception: # Roll back partial database work so the event can be retried safely. if connection: connection.rollback() # 500 keeps the delivery failed instead of marking unfinished work as done. abort(500) finally: # Close the database connection. if connection: connection.close() ``` https://gamemonitoring.ro/developers/docs/webhook/vote.md --- # Adrese IP sistem GAMEMONITORING folosește aceste IP-uri pentru verificarea serverelor de joc și livrarea [cererilor Webhook](https://gamemonitoring.ro/developers/docs/webhook#connect) către sistemul dvs. Adăugați-le în allowlist dacă serverul, site-ul, WAF, CDN sau bot protection limitează cererile primite. ## Când trebuie adăugate {#when-needed} - serverul de joc acceptă cereri doar de la adrese permise; - [handlerul Webhook](https://gamemonitoring.ro/developers/docs/webhook#handler-requirements) este protejat de firewall, WAF sau Cloudflare; - bot protection blochează cereri automate; - furnizorul de hosting cere lista de IP-uri pentru reguli de rețea. ## Exemplu de utilizare {#usage-example} Exemplu Webhook: handlerul este la `https://panel.example.com/gamemonitoring-webhook`, iar domeniul este protejat de Cloudflare. Adăugați IP-urile GAMEMONITORING în allowlist pentru domeniu sau calea exactă, ca Cloudflare să nu afișeze challenge și să nu blocheze [cereri Webhook `POST`](https://gamemonitoring.ro/developers/docs/webhook#handler-requirements). Exemplu server de joc: firewallul permite portul query doar adreselor de încredere. Adăugați IP-urile GAMEMONITORING în regula pentru portul query, altfel monitorizarea nu va verifica stabil online-ul și starea serverului. ## Configurarea allowlist {#allowlist} Transmiteți IP-urile din lista de mai sus administratorului sau furnizorului de hosting. Regula trebuie să permită cereri primite de la aceste adrese către serverul de joc sau handlerul Webhook. Dacă regula este pe cale, limitați-o la endpointul necesar, de exemplu `/gamemonitoring-webhook`. Dacă regula este pe port, indicați doar portul query al jocului sau portul web-serverului care primește Webhook. ## Verificare după configurare {#verification} După schimbarea regulilor, trimiteți o cerere de test sau un [Webhook de test](https://gamemonitoring.ro/developers/docs/webhook#tests-resend) și verificați că cererea nu mai este blocată. Dacă verificarea eșuează, consultați logurile firewall, WAF sau Cloudflare. Logurile trebuie să arate IP-ul sursă, calea cererii și motivul blocării. Așa identificați domeniul, calea, portul sau ordinea regulilor lipsă. ## Configurare Cloudflare {#cloudflare} Dacă handlerul Webhook este în spatele Cloudflare, adăugați IP-urile GAMEMONITORING într-o regulă care sare verificările WAF pentru aceste cereri: 1. Conectați-vă în dashboardul Cloudflare. 2. Selectați domeniul. 3. Deschideți **Security**. 4. Selectați **WAF**. 5. Deschideți **Custom rules**. 6. Apăsați **Create rule**. 7. Alegeți un nume clar, de exemplu **Allow GAMEMONITORING**. 8. În **Field**, selectați **IP Source Address**. 9. În **Operator**, selectați **is in**. 10. În **Value**, adăugați IP-urile din lista de mai sus. 11. În **Choose action**, selectați **Skip**. 12. În **WAF components to skip**, selectați verificările care blochează cereri către handler. 13. În **Select order**, selectați **First**. 14. Apăsați **Deploy**. Dacă cererile sunt încă blocate, verificați logurile firewall sau Cloudflare și asigurați-vă că regula se aplică domeniului și căii handlerului corecte. ```http GET https://api.gamemonitoring.ro/pages/system/ips ``` https://gamemonitoring.ro/developers/docs/ips.md