GitHub

ApiMocker ApiMocker

A comprehensive fake REST API service for developers

10

Users

100

Posts

200

Todos

500

Comments

โœจ Features

๐Ÿ”’ Rate Limiting

100 writes/day per IP, 1000 reads/15min per IP

โœ… Validation

Comprehensive input validation for all endpoints

๐Ÿ“„ Pagination

Built-in pagination with customizable limits

๐Ÿ” Advanced Filtering

Text search, sorting, and complex filtering

๐Ÿ”Ž Global Search

Search across all resources with type filtering

โฑ๏ธ Delay Simulation

Test loading states with configurable delays

๐Ÿšจ Error Simulation

Dedicated endpoints for testing error handling

๐Ÿ“ Logging

Detailed request/response logging with Winston

๐Ÿ”„ Auto Reset

Daily database reset at midnight UTC

๐Ÿ”— API Endpoints

All endpoints are available under /api prefix:

Users

GET /users
Get all users with pagination
GET /users/:id
Get user by ID
POST /users
Create a new user
PUT /users/:id
Update user
PATCH /users/:id
Partial update user
DELETE /users/:id
Delete user

Posts

GET /posts
Get all posts with filtering
GET /posts/:id
Get post by ID
POST /posts
Create a new post
PUT /posts/:id
Update post
PATCH /posts/:id
Partial update post
DELETE /posts/:id
Delete post

Todos

GET /todos
Get all todos with completion filtering
GET /todos/:id
Get todo by ID
POST /todos
Create a new todo
PUT /todos/:id
Update todo
PATCH /todos/:id
Partial update todo
DELETE /todos/:id
Delete todo

Comments

GET /comments
Get all comments with post filtering
GET /comments/:id
Get comment by ID
POST /comments
Create a new comment
PUT /comments/:id
Update comment
PATCH /comments/:id
Partial update comment
DELETE /comments/:id
Delete comment

Advanced Features

GET /posts/search?q=development
Search posts by title and content
GET /users/search?q=john
Search users by name, username, or email
GET /posts?title_like=web
Advanced filtering with text search
GET /posts?_delay=2000
Response delay simulation
GET /error/404
Simulate 404 error for testing

๐Ÿงช Quick Test

Try these endpoints to test the API:

Get Users Get Posts Get Todos Get Comments Search Posts Health Check

๐Ÿ“š Getting Started

ApiMocker is a comprehensive fake REST API service perfect for development, testing, and tutorials.

Quick Start

GET /users
Start by fetching users to see the API in action

Base URL

All API endpoints are available at: https://apimocker.com

Authentication

No authentication required! This is a public API for testing purposes.

Rate Limiting

  • Write Operations: 100 requests per day per IP
  • Read Operations: 1000 requests per 15 minutes per IP
  • Reset: Daily at midnight UTC

๐Ÿ”ง Advanced Usage

Filtering & Search

GET /posts?title_like=web&_sort=id&_order=desc
Advanced filtering with text search and sorting

Resource Search

GET /posts/search?q=development
Search posts by title and content
GET /users/search?q=john
Search users by name, username, or email

Response Delay

GET /posts?_delay=2000
Simulate loading states for frontend testing

Error Testing

GET /error/404
Test error handling in your applications

๐Ÿ“‹ Request Examples

Create a Post

POST /posts
Body:
{
  "title": "My New Post",
  "body": "This is the content of my post"
}

Update a Todo

PATCH /todos/1
Body:
{
  "completed": true
}

๐Ÿšจ Error Handling

All endpoints return consistent error responses:

Validation Error (400)

GET /error/validation
Test validation error responses

Not Found (404)

GET /error/404
Test resource not found errors

Server Error (500)

GET /error/500
Test server error responses

Rate Limit Exceeded (429)

When you exceed rate limits, you'll receive a 429 status with reset information.

๐Ÿ“Š Data Structure

All responses follow a consistent structure:

List Response

GET /posts
Response includes:
โ€ข data - Array of resources
โ€ข pagination - Page info and navigation
โ€ข X-Total-Count header - Total items count

Single Resource Response

GET /posts/1
Response includes:
โ€ข data - Single resource object
โ€ข Related data (user info, comments, etc.)