Mock API

// Integration Testing Server

Complete Mock API with OAuth 2.0, API Key, and Basic Auth. Full CRUD operations, advanced filtering, file uploads, and rich nested data structures for comprehensive integration testing.

System Capabilities

🔐

Full OAuth 2.0

Client credentials, password, authorization_code, and refresh_token grant types. Token introspection and revocation included.

🔑

Multi-Auth Support

JWT Bearer tokens, API Key (X-API-Key header), and HTTP Basic Auth. All methods work interchangeably.

📦

Full CRUD Operations

GET, POST, PUT, PATCH, DELETE for all resources. No field restrictions on updates - perfect for mock testing.

🔍

Advanced Filtering

Field filters, numeric ranges, date ranges, text search, tags, and field selection. Paginated responses with metadata.

📤

File Upload

Single and multiple file upload endpoints returning mock CDN URLs. Image validation endpoint included.

🗃️

Rich Nested Data

Products with variants, specs, reviews. Users with addresses, permissions. Sales with tracking events and pricing breakdowns.

Quick Start

Get OAuth Token POST
# Request token using client credentials
curl -X POST /oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "client123",
    "client_secret": "secret123"
  }'
API Key Auth GET
# Simple API Key authentication
curl -X GET /api/products \
  -H "X-API-Key: api-key-123456"

# Available API Keys:
# • api-key-123456 (admin)
# • api-key-789012 (user)
Basic Auth GET
# HTTP Basic Authentication
curl -X GET /api/users \
  -u admin:admin123

# Valid credentials:
# • admin:admin123
# • johndoe:password123
Advanced Filtering GET
# Filter products by multiple criteria
curl -X GET "/api/products/paginated?\
  brand=Apple&\
  minPrice=500&\
  maxPrice=2000&\
  minRating=4&\
  fields=id,name,price,brand" \
  -H "X-API-Key: api-key-123456"

Filter Parameters

Parameter Type Description Example
page number Page number (1-based) 1
limit number Items per page 10
sortBy string Sort field (supports nested paths) price, pricing.total
sortOrder string Sort direction asc, desc
search string Global text search laptop
category string Filter by category Electronics
brand string Filter by brand Apple
minPrice / maxPrice number Price range 100, 1000
minRating number Minimum rating (1-5) 4
status string Filter by status (sales) delivered
createdAfter / createdBefore ISO 8601 Date range filter 2024-01-01T00:00:00Z
tags string Filter by tags (comma-separated) premium,wireless
fields string Select specific fields id,name,price

API Endpoints

🔐 OAuth 2.0

GET /oauth/authorize
POST /oauth/token
POST /oauth/introspect
POST /oauth/revoke
GET /oauth/userinfo
GET /.well-known/oauth-authorization-server

👥 Users

GET /api/users List all
GET /api/users/paginated With filters
GET /api/users/:id
POST /api/users
PUT /api/users/:id Full update
PATCH /api/users/:id Partial
DEL /api/users/:id

📦 Products

GET /api/products List all
GET /api/products/paginated With filters
GET /api/products/:id
POST /api/products
PUT /api/products/:id Full update
PATCH /api/products/:id Partial
DEL /api/products/:id

🛒 Sales

GET /api/sales List all
GET /api/sales/paginated With filters
GET /api/sales/:id
POST /api/sales
PUT /api/sales/:id Full update
PATCH /api/sales/:id Partial
DEL /api/sales/:id

📤 File Upload

POST /api/upload/single Single file
POST /api/upload/multiple Multiple files
POST /api/upload/image Image only

Authentication Methods

JWT Bearer Token

Authorization: Bearer <access_token> # Get token first via POST /oauth/token # Token expires in 3600 seconds

API Key

X-API-Key: api-key-123456 # Available keys: • api-key-123456 (admin) • api-key-789012 (user)

Basic Auth

Authorization: Basic <base64> # Or use -u flag in curl: curl -u admin:admin123 /api/users

OAuth Client Credentials

POST /oauth/token { "grant_type": "client_credentials", "client_id": "client123", "client_secret": "secret123" }