$ cat api-documentation.md

API Documentation

RESTful API endpoints and usage examples

Base URL

https://w3rf.nl/api
Content-Type: application/json
Authorization: Bearer <token>

Authentication

POST /api/auth/login

Authenticate user and receive token

{
  "username": "demo",
  "password": "demo123"
}

Response (200):
{
  "token": "eyJhbGc...",
  "username": "demo",
  "expiresIn": 3600
}
POST /api/auth/logout

Logout and invalidate token

Headers:
Authorization: Bearer <token>

Response (200):
{
  "message": "Logged out successfully"
}

Dashboard

GET /api/dashboard/projects

Get user's projects

Response (200):
{
  "projects": [
    {
      "id": 1,
      "name": "w3rf-site",
      "status": "active",
      "created": "2024-01-15"
    }
  ]
}
POST /api/dashboard/notes

Create a new note

{
  "title": "My Note",
  "content": "Note content here"
}

Response (201):
{
  "id": 1,
  "title": "My Note",
  "content": "Note content here",
  "created": "2024-04-28T10:30:00Z"
}

Tools

POST /api/tools/json/format

Format and validate JSON

{
  "json": "{\"key\":\"value\"}"
}

Response (200):
{
  "formatted": "{
  \"key\": \"value\"
}",
  "valid": true
}
POST /api/tools/password/generate

Generate secure password

{
  "length": 16,
  "includeSymbols": true,
  "includeNumbers": true
}

Response (200):
{
  "password": "Xy9#kL2@mN4$pQ7!",
  "strength": "strong"
}

Error Responses

400 Bad Request:
{
  "error": "Invalid request",
  "message": "Missing required field: username"
}

401 Unauthorized:
{
  "error": "Unauthorized",
  "message": "Invalid token or credentials"
}

404 Not Found:
{
  "error": "Not found",
  "message": "Resource does not exist"
}

500 Server Error:
{
  "error": "Internal server error",
  "message": "Something went wrong"
}