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.

MethodEndpointDescription
GET/mock/usersList all users
GET/mock/users/:idGet single user
POST/mock/usersCreate user
PUT/mock/users/:idReplace user
PATCH/mock/users/:idUpdate user
DELETE/mock/users/:idDelete user
GET/mock/postsList all posts
GET/mock/posts/:idGet single post
POST/mock/postsCreate post
PUT/mock/posts/:idReplace post
PATCH/mock/posts/:idUpdate post
DELETE/mock/posts/:idDelete post
GET/mock/commentsList all comments
GET/mock/comments/:idGet single comment
POST/mock/commentsCreate comment
PUT/mock/comments/:idReplace comment
PATCH/mock/comments/:idUpdate comment
DELETE/mock/comments/:idDelete comment
GET/mock/todosList all todos
GET/mock/todos/:idGet single todo
POST/mock/todosCreate todo
PUT/mock/todos/:idReplace todo
PATCH/mock/todos/:idUpdate todo
DELETE/mock/todos/:idDelete todo
GET/mock/albumsList all albums
GET/mock/albums/:idGet single album
POST/mock/albumsCreate album
PUT/mock/albums/:idReplace album
PATCH/mock/albums/:idUpdate album
DELETE/mock/albums/:idDelete album
GET/mock/photosList all photos
GET/mock/photos/:idGet single photo
POST/mock/photosCreate photo
PUT/mock/photos/:idReplace photo
PATCH/mock/photos/:idUpdate photo
DELETE/mock/photos/:idDelete photo
GET/mock/categoriesList all categories
GET/mock/categories/:idGet single category
POST/mock/categoriesCreate category
PUT/mock/categories/:idReplace category
PATCH/mock/categories/:idUpdate category
DELETE/mock/categories/:idDelete category
GET/mock/productsList all products
GET/mock/products/:idGet single product
POST/mock/productsCreate product
PUT/mock/products/:idReplace product
PATCH/mock/products/:idUpdate product
DELETE/mock/products/:idDelete product
GET/mock/ordersList all orders
GET/mock/orders/:idGet single order
POST/mock/ordersCreate order
PUT/mock/orders/:idReplace order
PATCH/mock/orders/:idUpdate order
DELETE/mock/orders/:idDelete order
GET/mock/reviewsList all reviews
GET/mock/reviews/:idGet single review
POST/mock/reviewsCreate review
PUT/mock/reviews/:idReplace review
PATCH/mock/reviews/:idUpdate review
DELETE/mock/reviews/:idDelete review
GET/mock/notificationsList all notifications
GET/mock/notifications/:idGet single notification
POST/mock/notificationsCreate notification
PUT/mock/notifications/:idReplace notification
PATCH/mock/notifications/:idUpdate notification
DELETE/mock/notifications/:idDelete notification

Nested Resources

MethodEndpointDescription
GET/mock/users/:id/postsUser's posts
GET/mock/users/:id/commentsUser's comments
GET/mock/users/:id/todosUser's todos
GET/mock/users/:id/albumsUser's albums
GET/mock/users/:id/ordersUser's orders
GET/mock/users/:id/reviewsUser's reviews
GET/mock/users/:id/notificationsUser's notifications
GET/mock/posts/:id/commentsPost's comments
GET/mock/albums/:id/photosAlbum's photos
GET/mock/categories/:id/productsCategory's products
GET/mock/products/:id/reviewsProduct's reviews

Authentication

MethodEndpointDescription
POST/mock/auth/registerRegister new user email + password
POST/mock/auth/loginLogin (any password works) email + password
POST/mock/auth/refreshRefresh token Bearer token
GET/mock/auth/meCurrent user Bearer token
POST/mock/auth/logoutInvalidate token

Webhooks

Register URLs to receive event notifications when resources change. Deliveries are simulated (logged, not sent) for safe testing.

MethodEndpointDescription
GET/mock/webhooksList all webhooks
POST/mock/webhooksRegister webhook url + events[]
GET/mock/webhooks/:idGet webhook
PATCH/mock/webhooks/:idUpdate webhook
DELETE/mock/webhooks/:idDelete webhook + deliveries
GET/mock/webhooks/:id/deliveriesDelivery history
POST/mock/webhooks/:id/testSend 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

MethodEndpointDescription
GET/mock/healthHealth check + memory + data counts
ANY/mock/echoEcho back request details
ANY/mock/status/:codeReturn specific HTTP status code
ANY/mock/delay/:msDelayed response (max 10s)
GET/mock/random/uuidRandom UUID(s) ?count=5
GET/mock/random/numberRandom number(s) ?min=0&max=100&count=5
GET/mock/random/textLorem ipsum text ?paragraphs=3
POST/mock/uploadFile upload mock (returns fake URL)
GET/mock/streamSSE event stream (1 event/sec, max 50)
POST/mock/batchBatch operations (max 20)

Database Management

MethodEndpointDescription
POST/mock/db/resetReset all data to initial state
GET/mock/db/statsDatabase statistics
POST/mock/db/seedRe-seed with custom counts { users: 100 }
GET/mock/db/exportExport entire database as JSON
GET/mock/openapi.jsonOpenAPI 3.1.0 specification

Advanced Features

FeatureUsageDescription
Soft deleteDELETE /:resource/:idSets deletedAt instead of removing. Use ?_hard=true for permanent delete.
RestorePOST /:resource/:id/restoreRestore a soft-deleted resource
Bulk deleteDELETE /:resource?ids=1,2,3Delete multiple items at once
Bulk updatePATCH /:resource?ids=1,2,3Update multiple items with one body
Nested createPOST /users with {"todos":[...]}Create parent + children in one request
ValidationPOST/PUT/PATCHReturns 422 with field errors for required, enum, range, email
File uploadPOST /:resource/:id/uploadAttach mock file to resource. {"field":"avatar"}
GraphQLPOST /mock/graphql{"query":"{ users(limit:5) { id email posts { title } } }"}
WebSocketws://*/wsSubscribe to resource channels, receive events on mutations
Activity feed/mock/activityLog of all create/update/delete operations
ConfigPOST /mock/config{"users":{"error":500,"delay":2000}} — per-resource error/delay simulation
Aggregation?_groupBy=field&_metrics=price:avgGroup by field + compute avg, sum, min, max
Cursor pagination?_cursor=&_limit=20Cursor-based pagination via X-Cursor-Next header
Export CSV?_format=csvDownload as CSV file
Export XML?_format=xmlResponse in XML format
Omit fields?_omit=address,companyExclude fields (inverse of _fields)
If-Modified-SinceHeader on GET /:idReturns 304 if not changed since date
Per-user rate limitAutomaticAuthenticated 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

HeaderDescription
X-Total-CountTotal items in collection (before pagination)
X-PageCurrent page number
X-Per-PageItems per page
X-Request-IdUnique request identifier
X-Response-TimeProcessing time in ms
X-RateLimit-LimitMax requests per window
X-RateLimit-RemainingRemaining requests
X-RateLimit-ResetWindow reset timestamp
LinkPagination links (first, prev, next, last)
ETagEntity tag for conditional requests (single items)

Notes