W33DEV |

API Documentation

Not authenticated
← Back to Home

W33DEV API Documentation v1.1

Welcome to the W33DEV API documentation. This comprehensive RESTful API provides access to user authentication, project management, services management, W33Keys integration, and administrative functions.

🎉 Latest Updates (Juli 2025)

  • • Services Management API - Full CRUD operations with real database integration
  • • Schema-Compatible API - Frontend-to-database field mapping with robust error handling
  • • Advanced Service Categories - Real database enum mapping (web_development, app_development, design, consulting, maintenance)
  • • Flexible Pricing System - Support for different price types and currencies
  • • Enhanced Search & Filtering - Debounced search with category and status filters
  • • W33Keys API Integration - Comprehensive API key management
  • • Multiple API Variants - Test, Debug, and Compatible versions for development flexibility
  • • Enhanced Authentication - 30-minute sessions with robust token handling
  • • Debug & Diagnostic Tools - Comprehensive API testing suite with step-by-step diagnostics
  • • Production-Ready Deployment - Live on w33dev.net with CORS support

Base URL

https://w33dev.net/api

Version

v1

Content Type

application/json

🚀 Quick API Test

Test API endpoints directly from this documentation

🔐 Authentication

All dashboard API endpoints require JWT token authentication. Include the token in the Authorization header.

Authorization: Bearer YOUR_JWT_TOKEN
POST /auth.php

Login

Authenticate and receive JWT token

Request Body:

{
  "email": "admin@w33dev.net",
  "password": "your_password"
}

Response:

{
  "success": true,
  "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
  "user": {
    "user_id": 1,
    "email": "admin@w33dev.net",
    "role": "admin"
  }
}
POST /register.php

Register

Create new user account

Request Body:

{
  "email": "user@example.com",
  "password": "securepassword",
  "username": "username"
}

📊 Dashboard API

Administrative endpoints for managing projects, templates, services, and API keys. Base path: /api/dashboard.php

📂 Projects

GET /dashboard.php/projects

Get All Projects

Retrieve list of all projects

Response:
[
  {
    "id": 1,
    "name": "Website Redesign",
    "description": "Complete website overhaul",
    "status": "in_progress",
    "priority": "high",
    "start_date": "2024-01-01",
    "end_date": "2024-03-01",
    "client_name": "Client Name",
    "budget": 15000.00,
    "created_at": "2024-01-01T00:00:00Z"
  }
]
POST /dashboard.php/projects

Create Project

Create a new project

Request Body:
{
  "name": "New Project",
  "description": "Project description",
  "status": "planning",
  "priority": "medium",
  "start_date": "2024-01-01",
  "end_date": "2024-06-01",
  "client_name": "Client Name",
  "budget": 10000.00
}
PUT /dashboard.php/projects/{id}

Update Project

Update existing project

DELETE /dashboard.php/projects/{id}

Delete Project

Remove project from system

🔧 Services Management

Complete CRUD operations for services management with real database integration. Base path: /api/services-compatible.php

📊 Database Schema

Services table structure with frontend-to-database field mapping:

Frontend Fields:
  • id - Service ID
  • name - Service name
  • description - Service description
  • category - Service category
  • status - Service status
  • price - Service price
  • duration - Estimated duration
Database Fields:
  • id - Primary key
  • name - Service name
  • description - Service description
  • category - ENUM (web_development, app_development, design, consulting, maintenance)
  • is_active - Boolean (maps to status)
  • base_price - DECIMAL(10,2)
  • duration_estimate - VARCHAR(100)
  • price_type - ENUM ('hourly', 'project', 'monthly')
  • currency - VARCHAR(3) (default: EUR)
  • created_at - Timestamp
  • updated_at - Timestamp
GET /api/services-compatible.php

Get All Services

Retrieve list of all services with optional filtering

Query Parameters:
  • category - Filter by category (web, mobile, design, consulting, maintenance)
  • status - Filter by status (active, inactive)
  • search - Search in name and description
Response:
{
  "success": true,
  "data": [
    {
      "id": 1,
      "name": "Website Development",
      "description": "Complete website development service",
      "category": "web",
      "status": "active",
      "price": 2500.00,
      "duration": "4-6 weeks",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "count": 1,
  "filters": {
    "category": null,
    "status": null,
    "search": null
  }
}
GET /api/services-compatible.php/{id}

Get Single Service

Retrieve a specific service by ID

Response:
{
  "success": true,
  "data": {
    "id": 1,
    "name": "Website Development",
    "description": "Complete website development service",
    "category": "web",
    "status": "active",
    "price": 2500.00,
    "duration": "4-6 weeks",
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
}
POST /api/services-compatible.php

Create Service

Create a new service

Request Body:
{
  "name": "Mobile App Development",
  "description": "iOS and Android app development",
  "category": "mobile",
  "status": "active",
  "price": 5000.00,
  "duration": "8-12 weeks"
}
Response (201 Created):
{
  "success": true,
  "data": {
    "id": 2,
    "name": "Mobile App Development",
    "description": "iOS and Android app development",
    "category": "mobile",
    "status": "active",
    "price": 5000.00,
    "duration": "8-12 weeks",
    "created_at": "2024-07-01T10:30:00Z",
    "updated_at": "2024-07-01T10:30:00Z"
  }
}
PUT /api/services-compatible.php/{id}

Update Service

Update existing service (partial updates supported)

Request Body:
{
  "price": 5500.00,
  "duration": "10-14 weeks",
  "status": "active"
}
Response:
{
  "success": true,
  "data": {
    "id": 2,
    "name": "Mobile App Development",
    "description": "iOS and Android app development",
    "category": "mobile",
    "status": "active",
    "price": 5500.00,
    "duration": "10-14 weeks",
    "created_at": "2024-07-01T10:30:00Z",
    "updated_at": "2024-07-01T11:15:00Z"
  }
}
DELETE /api/services-compatible.php/{id}

Delete Service

Remove service from system

Response:
{
  "success": true,
  "message": "Service deleted successfully",
  "data": {
    "deleted_id": 2,
    "deleted_at": "2024-07-01T11:20:00Z"
  }
}

🔀 API Variants

Multiple API endpoints for different development needs:

✅ Compatible API (Recommended)

/api/services-compatible.php

Production-ready with real database integration and field mapping

🧪 Test API

/api/services-test.php

Mock data for frontend development and testing

🔧 Debug API

/api/services-debug.php

Diagnostic information and step-by-step debugging

🔑 W33Keys API Management

Comprehensive API key management system with role-based access control. Base path: /api/w33keys.php

GET /api/w33keys.php

Get All API Keys

Retrieve list of all API keys with usage statistics

Response:
{
  "success": true,
  "data": [
    {
      "id": 1,
      "key_name": "Frontend API Key",
      "key_prefix": "w33k_****",
      "permissions": ["read", "write"],
      "status": "active",
      "last_used": "2024-07-01T10:00:00Z",
      "usage_count": 1247,
      "created_at": "2024-01-01T00:00:00Z"
    }
  ]
}
POST /api/w33keys.php

Generate API Key

Create new API key with specified permissions

Request Body:
{
  "key_name": "Mobile App API Key",
  "permissions": ["read", "write"],
  "description": "API key for mobile application"
}
POST /dashboard.php/templates

Create Template

Add new template to library

🛠️ Services

GET /dashboard.php/services

Get All Services

Retrieve list of all services

Response:
[
  {
    "id": 1,
    "name": "Web Development",
    "category": "web",
    "description": "Full-stack web development services",
    "price": 1500.00,
    "duration": 40,
    "status": "active",
    "created_at": "2024-01-01T00:00:00Z"
  }
]
POST /dashboard.php/services

Create Service

Add new service offering

🔑 W33Keys API Management

GET /dashboard.php/w33keys

Get All API Keys

Retrieve list of all managed API keys

Response:
[
  {
    "id": 1,
    "api_name": "OpenAI API",
    "endpoint_url": "https://api.openai.com/v1/",
    "description": "AI model API access",
    "status": "active",
    "rate_limit": 1000,
    "usage_count": 245,
    "last_used": "2024-01-15T10:30:00Z",
    "created_at": "2024-01-01T00:00:00Z"
  }
]
POST /dashboard.php/w33keys

Add New API Key

Register new API key for management

⚠️ Error Codes

400 - Bad Request

Invalid request parameters or missing required fields

401 - Unauthorized

Invalid or missing authentication token

403 - Forbidden

Insufficient permissions for requested action

404 - Not Found

Requested resource does not exist

429 - Rate Limited

Too many requests, rate limit exceeded

500 - Server Error

Internal server error occurred

💡 Usage Examples

JavaScript Fetch Example

const token = localStorage.getItem('adminToken');

// Get all projects
const response = await fetch('/api/dashboard.php/projects', {
    method: 'GET',
    headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
    }
});

const projects = await response.json();
console.log(projects);

Create New Project Example

const newProject = {
    name: "E-commerce Platform",
    description: "Full-featured online store with payment integration",
    status: "planning",
    priority: "high",
    start_date: "2024-02-01",
    end_date: "2024-08-01",
    client_name: "RetailCorp",
    budget: 25000.00
};

const response = await fetch('/api/dashboard.php/projects', {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(newProject)
});

const result = await response.json();
console.log('Project created:', result);

🚨 Error Handling & Diagnostics

Comprehensive error handling and diagnostic tools for API development and troubleshooting.

📋 Standard Error Responses

400 Bad Request

{
  "success": false,
  "error": "Invalid JSON input",
  "timestamp": "2024-07-01T12:00:00Z",
  "debug": {
    "provided_data": null,
    "expected_format": "JSON object"
  }
}

401 Unauthorized

{
  "success": false,
  "error": "Authentication required",
  "timestamp": "2024-07-01T12:00:00Z",
  "debug": {
    "provided_token": false,
    "suggestion": "Include Authorization header"
  }
}

404 Not Found

{
  "success": false,
  "error": "Service not found",
  "timestamp": "2024-07-01T12:00:00Z",
  "debug": {
    "requested_id": 999,
    "table": "services"
  }
}

500 Server Error

{
  "success": false,
  "error": "Database connection failed",
  "timestamp": "2024-07-01T12:00:00Z",
  "debug": {
    "error_code": 2002,
    "error_message": "Connection refused",
    "suggestion": "Check database status"
  }
}

🔧 Diagnostic Tools

GET /api/services-diagnostic.php

Full Diagnostics

Comprehensive system diagnostics with step-by-step checks

Features:
  • • Database connection test
  • • Table schema validation
  • • PHP environment check
  • • File permissions audit
  • • API endpoint testing
GET /api/services-simple-diagnostic.php

Simple Diagnostics

Quick health check for basic functionality

Response:
{
  "status": "healthy",
  "database": "connected",
  "php_version": "8.3.22",
  "timestamp": "2024-07-01T12:00:00Z"
}
GET /api/php-test.php

PHP Environment Test

PHP configuration and environment verification

Response:
{
  "php_version": "8.3.22",
  "extensions": ["pdo", "pdo_mysql", "json"],
  "memory_limit": "256M",
  "database_test": "success"
}

🎯 Debug Center

Interactive debugging interface for testing all API endpoints with real-time monitoring. Available at: /api/debug-center.html

Features:

  • • Live API endpoint testing
  • • Multiple API variant switching
  • • Real-time response monitoring
  • • JSON response formatting
  • • Error analysis and suggestions

Available Tests:

  • • Services CRUD operations
  • • Authentication testing
  • • Database connectivity
  • • PHP environment check
  • • CORS configuration test

💻 Code Examples

Complete code examples for integrating with the W33DEV API using various programming languages and frameworks.

JavaScript/Frontend Integration

// Services API Integration
class W33DevAPI {
    constructor(baseUrl = '/api', token = null) {
        this.baseUrl = baseUrl;
        this.token = token;
        this.apiVariant = 'services-compatible.php';
    }

    async request(endpoint, options = {}) {
        const url = `${this.baseUrl}/${endpoint}`;
        const config = {
            headers: {
                'Content-Type': 'application/json',
                ...options.headers
            },
            ...options
        };

        if (this.token) {
            config.headers.Authorization = `Bearer ${this.token}`;
        }

        try {
            const response = await fetch(url, config);
            const data = await response.json();
            
            if (!response.ok) {
                throw new Error(data.error || 'API request failed');
            }
            
            return data;
        } catch (error) {
            console.error('API Error:', error);
            throw error;
        }
    }

    // Services Management
    async getServices(filters = {}) {
        const params = new URLSearchParams(filters);
        return this.request(`${this.apiVariant}?${params}`);
    }

    async createService(serviceData) {
        return this.request(this.apiVariant, {
            method: 'POST',
            body: JSON.stringify(serviceData)
        });
    }

    async updateService(id, serviceData) {
        return this.request(`${this.apiVariant}/${id}`, {
            method: 'PUT',
            body: JSON.stringify(serviceData)
        });
    }

    async deleteService(id) {
        return this.request(`${this.apiVariant}/${id}`, {
            method: 'DELETE'
        });
    }
}

// Usage Example
const api = new W33DevAPI('/api', localStorage.getItem('adminToken'));

// Get all services
const services = await api.getServices();
console.log('Services:', services);

// Create new service
const newService = await api.createService({
    name: 'API Development',
    description: 'RESTful API development service',
    category: 'web',
    status: 'active',
    price: 3000.00,
    duration: '6-8 weeks'
});

// Update service
const updatedService = await api.updateService(newService.data.id, {
    price: 3500.00
});

// Delete service
await api.deleteService(newService.data.id);

PHP/Backend Integration

baseUrl = rtrim($baseUrl, '/');
        $this->token = $token;
    }
    
    private function request($endpoint, $method = 'GET', $data = null) {
        $url = $this->baseUrl . '/' . ltrim($endpoint, '/');
        
        $options = [
            'http' => [
                'method' => $method,
                'header' => [
                    'Content-Type: application/json',
                    'User-Agent: W33DEV-API-Client/1.0'
                ]
            ]
        ];
        
        if ($this->token) {
            $options['http']['header'][] = 'Authorization: Bearer ' . $this->token;
        }
        
        if ($data !== null) {
            $options['http']['content'] = json_encode($data);
        }
        
        $context = stream_context_create($options);
        $result = file_get_contents($url, false, $context);
        
        if ($result === false) {
            throw new Exception('API request failed');
        }
        
        return json_decode($result, true);
    }
    
    // Services Management
    public function getServices($filters = []) {
        $query = http_build_query($filters);
        $endpoint = 'services-compatible.php' . ($query ? '?' . $query : '');
        return $this->request($endpoint);
    }
    
    public function createService($serviceData) {
        return $this->request('services-compatible.php', 'POST', $serviceData);
    }
    
    public function updateService($id, $serviceData) {
        return $this->request("services-compatible.php/{$id}", 'PUT', $serviceData);
    }
    
    public function deleteService($id) {
        return $this->request("services-compatible.php/{$id}", 'DELETE');
    }
}

// Usage Example
$api = new W33DevApiClient('https://w33dev.net/api', $authToken);

try {
    // Get all services
    $services = $api->getServices();
    echo "Found " . count($services['data']) . " services\n";
    
    // Create new service
    $newService = $api->createService([
        'name' => 'Database Design',
        'description' => 'Professional database design and optimization',
        'category' => 'web',
        'status' => 'active',
        'price' => 1500.00,
        'duration' => '2-3 weeks'
    ]);
    
    echo "Created service: " . $newService['data']['name'] . "\n";
    
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
?>

Advanced Integration Examples

Debounced Search Implementation

// Debounced search for services
function debounce(func, wait) {
    let timeout;
    return function executedFunction(...args) {
        const later = () => {
            clearTimeout(timeout);
            func(...args);
        };
        clearTimeout(timeout);
        timeout = setTimeout(later, wait);
    };
}

const searchServices = debounce(async (query) => {
    const services = await api.getServices({
        search: query,
        status: 'active'
    });
    updateUI(services.data);
}, 300);

// Usage
document.getElementById('searchInput')
    .addEventListener('input', (e) => {
        searchServices(e.target.value);
    });

Error Handling with Retry Logic

// Robust error handling with retry
async function apiWithRetry(apiCall, maxRetries = 3) {
    for (let i = 0; i < maxRetries; i++) {
        try {
            return await apiCall();
        } catch (error) {
            if (i === maxRetries - 1) throw error;
            
            // Exponential backoff
            const delay = Math.pow(2, i) * 1000;
            await new Promise(resolve => 
                setTimeout(resolve, delay)
            );
        }
    }
}

// Usage
try {
    const services = await apiWithRetry(() => 
        api.getServices()
    );
    console.log('Services loaded:', services);
} catch (error) {
    console.error('Failed after retries:', error);
    showErrorMessage('Unable to load services');
}