Back to Homepage

API Documentation

Interview Demo: This content is fictional and created for demonstration purposes. This showcases a professional internet speed testing service for a technical interview.

Complete reference for all monitoring endpoints available on SpeedTest Pro

Base URL: https://broadbandgauge.com

Performance Testing Endpoints

These endpoints simulate different performance characteristics for monitoring systems.

GET /api/fast Quick response endpoint

Description

Returns a fast response in under 50ms. Ideal for testing optimal server performance.

Response Example

{
  "status": "success",
  "message": "Fast response",
  "timestamp": "2025-08-21T21:59:01.590Z",
  "responseTime": "12ms",
  "server": "node-express"
}
GET /api/medium Medium delay response

Description

Simulates medium server load with 100-300ms response time.

Response Example

{
  "status": "success",
  "message": "Medium delay response",
  "timestamp": "2025-08-21T21:59:01.590Z",
  "delay": "247ms",
  "load": "medium"
}
GET /api/slow Slow response endpoint

Description

Simulates heavy server load with 1-3 second response time.

Response Example

{
  "status": "success",
  "message": "Slow response",
  "timestamp": "2025-08-21T21:59:01.590Z",
  "delay": "2341ms",
  "load": "heavy"
}
GET /api/unreliable Unreliable endpoint with random failures

Description

Randomly fails 30% of requests to test error handling and retry logic.

Success Response (70%)

{
  "status": "success",
  "message": "Unreliable endpoint succeeded",
  "timestamp": "2025-08-21T21:59:01.590Z",
  "reliability": "70%"
}

Error Response (30%)

{
  "status": "error",
  "message": "Service temporarily unavailable",
  "code": 503,
  "timestamp": "2025-08-21T21:59:01.590Z"
}

Large Response Testing

GET /api/large Large response payload testing

Parameters

size integer - Response size in MB (default: 1, max: 50)

Example Usage

GET /api/large?size=10

Response

Returns a JSON object with generated test data of the specified size.

Enhanced Monitoring Endpoints

GET /api/monitoring/ping Advanced ping with metadata

Description

Enhanced ping endpoint that returns server metadata and performance metrics.

Response Example

{
  "status": "healthy",
  "timestamp": "2025-08-21T21:59:01.590Z",
  "server": {
    "uptime": 3600,
    "memory": "45.2MB",
    "cpu": "2.1%",
    "version": "1.0.0"
  },
  "location": "Dublin, Ireland",
  "ping": "pong"
}
GET /api/delay/:ms Configurable delay endpoint

Parameters

ms integer - Delay in milliseconds (max: 10000)

Example Usage

GET /api/delay/500

Response Example

{
  "status": "success",
  "message": "Delayed response",
  "requestedDelay": 500,
  "actualDelay": 503,
  "timestamp": "2025-08-21T21:59:01.590Z"
}
GET /api/metrics Real-time server metrics

Description

Returns comprehensive server performance metrics in real-time.

Response Example

{
  "timestamp": "2025-08-21T21:59:01.590Z",
  "server": {
    "uptime": 3600,
    "memory": {
      "used": "45.2MB",
      "free": "2.1GB",
      "total": "2.15GB"
    },
    "cpu": {
      "usage": "2.1%",
      "cores": 2
    },
    "requests": {
      "total": 1250,
      "successful": 1188,
      "failed": 62,
      "average_response_time": "245ms"
    }
  }
}
GET /api/time-based Time-based performance variation

Description

Performance varies based on current time to simulate real-world load patterns.

Performance Patterns

  • Peak Hours (9-17): Slower response (500-1000ms)
  • Off Hours (22-6): Fast response (50-100ms)
  • Normal Hours: Medium response (200-400ms)

System Health Endpoints

GET /health Basic health check

Description

Simple health check endpoint for monitoring system availability.

Response Example

{
  "status": "healthy",
  "timestamp": "2025-08-21T21:59:01.590Z",
  "uptime": 3600,
  "service": "SpeedTest Pro - Interview Demo Website",
  "version": "1.0.0",
  "environment": "production"
}
GET /api/ipinfo Client IP information

Description

Returns detailed information about the client's IP address and location.

Response Example

{
  "ip": "89.100.17.159",
  "city": "Dublin",
  "region": "Leinster",
  "country": "IE",
  "country_name": "Ireland",
  "timezone": "Europe/Dublin",
  "isp": "Virgin Media Ireland",
  "org": "Virgin Media",
  "as": "AS5089 Virgin Media Limited"
}

Usage Examples

cURL Examples

# Basic ping test
curl https://broadbandgauge.com/api/monitoring/ping

# Test with specific delay
curl https://broadbandgauge.com/api/delay/1000

# Large response test
curl https://broadbandgauge.com/api/large?size=5

# Get server metrics
curl https://broadbandgauge.com/api/metrics

JavaScript/Node.js

// Test endpoint reliability
async function testEndpoint() {
  try {
    const response = await fetch('https://broadbandgauge.com/api/unreliable');
    const data = await response.json();
    console.log('Success:', data);
  } catch (error) {
    console.error('Error:', error);
  }
}

// Monitor performance over time
async function monitorPerformance() {
  const start = Date.now();
  const response = await fetch('https://broadbandgauge.com/api/fast');
  const end = Date.now();
  console.log(`Response time: ${end - start}ms`);
}

Python

import requests
import time

# Performance monitoring script
def monitor_endpoint(url, iterations=10):
    results = []
    for i in range(iterations):
        start = time.time()
        response = requests.get(url)
        end = time.time()
        
        results.append({
            'status': response.status_code,
            'response_time': (end - start) * 1000,
            'data': response.json()
        })
    
    return results

# Test different endpoints
endpoints = [
    'https://broadbandgauge.com/api/fast',
    'https://broadbandgauge.com/api/medium',
    'https://broadbandgauge.com/api/slow'
]

for endpoint in endpoints:
    results = monitor_endpoint(endpoint)
    avg_time = sum(r['response_time'] for r in results) / len(results)
    print(f"{endpoint}: {avg_time:.2f}ms average")

Rate Limiting & Best Practices

Rate Limiting

This is a demo environment with generous rate limits:

  • General endpoints: 1000 requests/hour per IP
  • Large response endpoints: 100 requests/hour per IP
  • Health check: Unlimited

Important Notes

  • This is a demonstration environment for interview purposes
  • Do not use for production monitoring
  • Endpoints may return simulated data
  • Server may be reset without notice

Monitoring Recommendations

  • Start with /api/fast to verify connectivity
  • Use /api/unreliable to test error handling
  • Monitor /api/time-based for realistic patterns
  • Check /health for basic availability
Back to Homepage