Mock API
Full-featured REST API for testing and prototyping. All data lives in memory and resets on restart.
users: 50 | posts: 245 | comments: 500 | todos: 150 | albums: 33 | photos: 300 | categories: 8 | products: 50 | orders: 100 | reviews: 200 | notifications: 100
Resources
All resources support full CRUD + pagination, sorting, filtering, search, field selection, relation expansion.
| Method | Endpoint | Description |
| GET | /mock/users | List all users |
| GET | /mock/users/:id | Get single user |
| POST | /mock/users | Create user |
| PUT | /mock/users/:id | Replace user |
| PATCH | /mock/users/:id | Update user |
| DELETE | /mock/users/:id | Delete user |
| GET | /mock/posts | List all posts |
| GET | /mock/posts/:id | Get single post |
| POST | /mock/posts | Create post |
| PUT | /mock/posts/:id | Replace post |
| PATCH | /mock/posts/:id | Update post |
| DELETE | /mock/posts/:id | Delete post |
| GET | /mock/comments | List all comments |
| GET | /mock/comments/:id | Get single comment |
| POST | /mock/comments | Create comment |
| PUT | /mock/comments/:id | Replace comment |
| PATCH | /mock/comments/:id | Update comment |
| DELETE | /mock/comments/:id | Delete comment |
| GET | /mock/todos | List all todos |
| GET | /mock/todos/:id | Get single todo |
| POST | /mock/todos | Create todo |
| PUT | /mock/todos/:id | Replace todo |
| PATCH | /mock/todos/:id | Update todo |
| DELETE | /mock/todos/:id | Delete todo |
| GET | /mock/albums | List all albums |
| GET | /mock/albums/:id | Get single album |
| POST | /mock/albums | Create album |
| PUT | /mock/albums/:id | Replace album |
| PATCH | /mock/albums/:id | Update album |
| DELETE | /mock/albums/:id | Delete album |
| GET | /mock/photos | List all photos |
| GET | /mock/photos/:id | Get single photo |
| POST | /mock/photos | Create photo |
| PUT | /mock/photos/:id | Replace photo |
| PATCH | /mock/photos/:id | Update photo |
| DELETE | /mock/photos/:id | Delete photo |
| GET | /mock/categories | List all categories |
| GET | /mock/categories/:id | Get single category |
| POST | /mock/categories | Create category |
| PUT | /mock/categories/:id | Replace category |
| PATCH | /mock/categories/:id | Update category |
| DELETE | /mock/categories/:id | Delete category |
| GET | /mock/products | List all products |
| GET | /mock/products/:id | Get single product |
| POST | /mock/products | Create product |
| PUT | /mock/products/:id | Replace product |
| PATCH | /mock/products/:id | Update product |
| DELETE | /mock/products/:id | Delete product |
| GET | /mock/orders | List all orders |
| GET | /mock/orders/:id | Get single order |
| POST | /mock/orders | Create order |
| PUT | /mock/orders/:id | Replace order |
| PATCH | /mock/orders/:id | Update order |
| DELETE | /mock/orders/:id | Delete order |
| GET | /mock/reviews | List all reviews |
| GET | /mock/reviews/:id | Get single review |
| POST | /mock/reviews | Create review |
| PUT | /mock/reviews/:id | Replace review |
| PATCH | /mock/reviews/:id | Update review |
| DELETE | /mock/reviews/:id | Delete review |
| GET | /mock/notifications | List all notifications |
| GET | /mock/notifications/:id | Get single notification |
| POST | /mock/notifications | Create notification |
| PUT | /mock/notifications/:id | Replace notification |
| PATCH | /mock/notifications/:id | Update notification |
| DELETE | /mock/notifications/:id | Delete notification |
Nested Resources
| Method | Endpoint | Description |
| GET | /mock/users/:id/posts | User's posts |
| GET | /mock/users/:id/comments | User's comments |
| GET | /mock/users/:id/todos | User's todos |
| GET | /mock/users/:id/albums | User's albums |
| GET | /mock/users/:id/orders | User's orders |
| GET | /mock/users/:id/reviews | User's reviews |
| GET | /mock/users/:id/notifications | User's notifications |
| GET | /mock/posts/:id/comments | Post's comments |
| GET | /mock/albums/:id/photos | Album's photos |
| GET | /mock/categories/:id/products | Category's products |
| GET | /mock/products/:id/reviews | Product's reviews |
Authentication
| Method | Endpoint | Description |
| POST | /mock/auth/register | Register new user email + password |
| POST | /mock/auth/login | Login (any password works) email + password |
| POST | /mock/auth/refresh | Refresh token Bearer token |
| GET | /mock/auth/me | Current user Bearer token |
| POST | /mock/auth/logout | Invalidate token |
Webhooks
Register URLs to receive event notifications when resources change. Deliveries are simulated (logged, not sent) for safe testing.
| Method | Endpoint | Description |
| GET | /mock/webhooks | List all webhooks |
| POST | /mock/webhooks | Register webhook url + events[] |
| GET | /mock/webhooks/:id | Get webhook |
| PATCH | /mock/webhooks/:id | Update webhook |
| DELETE | /mock/webhooks/:id | Delete webhook + deliveries |
| GET | /mock/webhooks/:id/deliveries | Delivery history |
| POST | /mock/webhooks/:id/test | Send test event |
Event Patterns
# Subscribe to specific events
["users.created", "orders.updated", "products.deleted"]
# Wildcards
["*"] # All events on all resources
["users.*"] # All events on users
["*.created"] # All creation events
Example
# Register a webhook
curl -X POST /mock/webhooks \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/wh","events":["users.created","orders.*"]}'
# Create a user (triggers webhook)
curl -X POST /mock/users \
-H "Content-Type: application/json" \
-d '{"firstName":"Jane","lastName":"Doe","email":"jane@test.com"}'
# Check delivery log
curl /mock/webhooks/1/deliveries
Utility Endpoints
| Method | Endpoint | Description |
| GET | /mock/health | Health check + memory + data counts |
| ANY | /mock/echo | Echo back request details |
| ANY | /mock/status/:code | Return specific HTTP status code |
| ANY | /mock/delay/:ms | Delayed response (max 10s) |
| GET | /mock/random/uuid | Random UUID(s) ?count=5 |
| GET | /mock/random/number | Random number(s) ?min=0&max=100&count=5 |
| GET | /mock/random/text | Lorem ipsum text ?paragraphs=3 |
| POST | /mock/upload | File upload mock (returns fake URL) |
| GET | /mock/stream | SSE event stream (1 event/sec, max 50) |
| POST | /mock/batch | Batch operations (max 20) |
Database Management
| Method | Endpoint | Description |
| POST | /mock/db/reset | Reset all data to initial state |
| GET | /mock/db/stats | Database statistics |
| POST | /mock/db/seed | Re-seed with custom counts { users: 100 } |
| GET | /mock/db/export | Export entire database as JSON |
| GET | /mock/openapi.json | OpenAPI 3.1.0 specification |
Advanced Features
| Feature | Usage | Description |
| Soft delete | DELETE /:resource/:id | Sets deletedAt instead of removing. Use ?_hard=true for permanent delete. |
| Restore | POST /:resource/:id/restore | Restore a soft-deleted resource |
| Bulk delete | DELETE /:resource?ids=1,2,3 | Delete multiple items at once |
| Bulk update | PATCH /:resource?ids=1,2,3 | Update multiple items with one body |
| Nested create | POST /users with {"todos":[...]} | Create parent + children in one request |
| Validation | POST/PUT/PATCH | Returns 422 with field errors for required, enum, range, email |
| File upload | POST /:resource/:id/upload | Attach mock file to resource. {"field":"avatar"} |
| GraphQL | POST /mock/graphql | {"query":"{ users(limit:5) { id email posts { title } } }"} |
| WebSocket | ws://*/ws | Subscribe to resource channels, receive events on mutations |
| Activity feed | /mock/activity | Log of all create/update/delete operations |
| Config | POST /mock/config | {"users":{"error":500,"delay":2000}} — per-resource error/delay simulation |
| Aggregation | ?_groupBy=field&_metrics=price:avg | Group by field + compute avg, sum, min, max |
| Cursor pagination | ?_cursor=&_limit=20 | Cursor-based pagination via X-Cursor-Next header |
| Export CSV | ?_format=csv | Download as CSV file |
| Export XML | ?_format=xml | Response in XML format |
| Omit fields | ?_omit=address,company | Exclude fields (inverse of _fields) |
| If-Modified-Since | Header on GET /:id | Returns 304 if not changed since date |
| Per-user rate limit | Automatic | Authenticated users: 60/min (admin: unlimited) |
Query Parameters
Pagination
GET /mock/users?_page=2&_limit=10 # Page-based (X-Total-Count header)
GET /mock/users?_start=20&_end=30 # Slice-based
Sorting
GET /mock/users?_sort=lastName&_order=asc
GET /mock/posts?_sort=views,createdAt&_order=desc,asc # Multi-field
Filtering
GET /mock/users?role=admin # Exact match
GET /mock/users?role=admin,editor # OR match
GET /mock/products?price_gte=10&price_lte=100 # Range: _gte, _lte, _gt, _lt
GET /mock/users?email_ne=test@example.com # Not equal
GET /mock/posts?title_like=typescript # Contains (case-insensitive)
Search
GET /mock/posts?q=javascript # Full-text search across all string fields
Field Selection
GET /mock/users?_fields=id,firstName,email # Return only specified fields
Relations
GET /mock/posts?_expand=user # Expand parent (embed user object)
GET /mock/users?_embed=posts # Embed children (include user's posts)
GET /mock/posts?_expand=user&_embed=comments # Both at once
Examples
# List users, page 2, sorted by name
curl https://api.rodin.dev/mock/users?_page=2&_limit=5&_sort=lastName
# Search posts containing "typescript"
curl https://api.rodin.dev/mock/posts?q=typescript&_fields=id,title,views
# Create a new todo
curl -X POST https://api.rodin.dev/mock/todos \
-H "Content-Type: application/json" \
-d '{"title":"Learn API design","priority":"high"}'
# Login and get token
curl -X POST https://api.rodin.dev/mock/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"james.smith@example.com","password":"any"}'
# Get user's posts with comments embedded
curl https://api.rodin.dev/mock/users/1/posts?_embed=comments
# Batch: get user and their posts in one request
curl -X POST https://api.rodin.dev/mock/batch \
-H "Content-Type: application/json" \
-d '[{"method":"GET","url":"/users/1"},{"method":"GET","url":"/users/1/posts"}]'
# Simulate a 500 error
curl https://api.rodin.dev/mock/status/500
# Delayed response (2 seconds)
curl https://api.rodin.dev/mock/delay/2000
# SSE event stream
curl -N https://api.rodin.dev/mock/stream
# Register a webhook and trigger it
curl -X POST https://api.rodin.dev/mock/webhooks \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/wh","events":["*"]}'
curl -X POST https://api.rodin.dev/mock/users \
-H "Content-Type: application/json" \
-d '{"firstName":"Test","lastName":"User","email":"test@demo.io"}'
curl https://api.rodin.dev/mock/webhooks/1/deliveries
Response Headers
| Header | Description |
X-Total-Count | Total items in collection (before pagination) |
X-Page | Current page number |
X-Per-Page | Items per page |
X-Request-Id | Unique request identifier |
X-Response-Time | Processing time in ms |
X-RateLimit-Limit | Max requests per window |
X-RateLimit-Remaining | Remaining requests |
X-RateLimit-Reset | Window reset timestamp |
Link | Pagination links (first, prev, next, last) |
ETag | Entity tag for conditional requests (single items) |
Notes
- All data is stored in memory — changes persist until server restart
- POST /mock/db/reset returns data to initial seed state
- Auth is simulated — any password works for login
- CORS is fully open — use from any origin
- Rate limit: 120 requests per 60s window (60/min per authenticated user, unlimited for admins)
- DELETE is soft by default (sets deletedAt) — use ?_hard=true for permanent delete
- POST/PUT/PATCH validate required fields, enums, ranges — returns 422 with field errors
- All mutations are logged to /activity feed and broadcast via WebSocket
- Max body size: 64 KB
- Max pagination limit: 100 items per page