Skip to content

Complete REST API Specifications ​

1. Global API Conventions ​

  • Endpoint Prefix: /api/v1.
  • Content-Type: application/json.
  • Authorization Header: Authorization: Bearer <JWT_TOKEN>.

2. Authentication API Module (/api/v1/auth) ​

2.1 Operator Login ​

  • Endpoint: POST /api/v1/auth/login
  • Request Body:
    json
    {
      "username": "admin",
      "password": "admin123"
    }
  • Response (200 OK):
    json
    {
      "success": true,
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "user": {
        "id": "usr_65a123",
        "username": "admin",
        "name": "Central Administrator",
        "role": "SUPER_ADMIN"
      }
    }

3. DRM Licensing API Module (/api/v1/licenses) ​

3.1 Issue License Token ​

  • Endpoint: POST /api/v1/licenses/generate
  • Security: Bearer <JWT>
  • Request Body:
    json
    {
      "npsn": "20201234",
      "school_name": "SMA Negeri 1 Mojokerto",
      "hardware_id": "CPU-UUID-9988-7766",
      "max_students": 500,
      "duration_days": 365,
      "operating_mode": "SEMI_OFFLINE"
    }
  • Response (201 Created):
    json
    {
      "success": true,
      "license_token": "eyJsaWNlbnNlX2lkIjoiTElDLTIwMjYtMDAxIi...",
      "payload": {
        "license_id": "LIC-2026-001",
        "expires_at": "2027-09-28T23:59:59Z",
        "signature": "Base64Signature=="
      }
    }

4. Synchronization API Module (/api/v1/sync) ​

4.1 Server Handshake Verification ​

  • Endpoint: POST /api/v1/sync/verify-server
  • Request Body:
    json
    {
      "server_code": "SRV-20201234-01",
      "npsn": "20201234",
      "hardware_id": "CPU-UUID-9988-7766",
      "license_token": "eyJsaWNlbnNlX2lk..."
    }
  • Response (200 OK):
    json
    {
      "success": true,
      "status": "VERIFIED",
      "server_name": "SRV-20201234-01",
      "server_time": "2026-09-28T09:40:00Z"
    }

4.2 Push Student Answers ​

  • Endpoint: POST /api/v1/sync/push-answers
  • Request Body:
    json
    {
      "server_code": "SRV-20201234-01",
      "npsn": "20201234",
      "checksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
      "total_records": 150,
      "answers": []
    }
  • Response (200 OK):
    json
    {
      "success": true,
      "message": "150 student answer records successfully received.",
      "sync_id": "65a99887766554433221100"
    }