PONG PRO API v1.0

Cloud Profile Sync

Optional backend for persisting player statistics across devices

Base URL

https://pong.deewhy.ovh
🔒 No authentication required. All requests are anonymous and identified by username only. If the API is unreachable, PONG PRO falls back gracefully to local-only mode.

Endpoints

POST /api/user/{username}

Create or load player profile

Called when a user logs in. Returns the current profile or creates a new one.

# Request
POST /api/user/Davide

# Response (200 OK)
{
  "username": "Davide",
  "total_wins": 12,
  "total_losses": 5,
  "total_matches": 17,
  "level": 3
}
POST /api/user/{username}/update

Update match result

Called when a match ends. Increments win/loss counters and recalculates level.

# Request
POST /api/user/Davide/update
Content-Type: application/json

{
  "win": true
}

# Response (200 OK)
{
  "status": "updated",
  "username": "Davide",
  "total_wins": 13,
  "level": 3
}

Data Model

{
  "username": "string (2-18 chars, alphanumeric)",
  "total_wins": "integer ≥ 0",
  "total_losses": "integer ≥ 0",
  "total_matches": "integer = wins + losses",
  "level": "integer ≥ 1 (derived from total_matches)"
}

Level calculation: level = 1 + floor(total_matches / 10)

Error Handling

All errors return JSON: {"error": "message"}

Client Implementation Notes