Playground API
DocsStatsBlogStudio
Documentation Tree
Technical BlogFeature Deep Dives
  • Introduction
  • Quickstart
    5 min
  • How It Works
  • Recipes & Cookbooks
  • Platform Comparisons
  • Real-World Showcase
  • Interactive Studio
    Studio
  • GraphiQL IDE
    IDE
  • Session Quotas & Activity
  • Network Chaos Simulator
  • Atomic Sandbox Reset
  • Overview & Models
    Hub
  • Users Resource
  • Posts Resource
  • Comments Resource
  • Todos Resource
  • Custom Collections
    Custom
  • Multipart File Uploads
    Upload
  • Dynamic SVG Avatars
    SVG
  • Image Thumbnails
    CDN
  • Relational Filtering
  • Full-Text Search
  • Dynamic Sorting
  • Offset Pagination
  • Cursor Pagination
    Scroll
  • CSV & Excel Export & Import
    IO
  • Custom Collections
    CRUD
  • Overview & Architecture
    Hub
  • JWT Auth Flow
  • Refresh Token Rotation
    Mutex
  • RBAC Permission Matrix
    Roles
  • Expiry Simulation
  • Clock Skew Drift
  • Password Recovery Loop
  • Dual-Mode Sandboxing
  • GraphiQL IDE
    IDE
  • Relational Queries
  • Stateful Mutations
  • Realtime Subscriptions
  • Overview & Flowcharts
    Hub
  • Hosted Checkout
    Stripe
  • Payment Intents API
  • 3DS Challenge Modal
    Modal
  • Customers Vault
  • Charges & Refunds
  • Test Cards Catalog
  • Overview & Channels
    Hub
  • Virtual Email Mailbox
    Mailtrap
  • Virtual SMS Terminal
    Phone
  • In-App Notifications
  • Message Dispatcher
  • Realtime Studio
    Studio
  • Native WebSocket (/ws)
  • Socket.io Gateway
  • Presence & Echo Bot
  • Server-Sent Events (SSE)
    SSE
  • Analytics Telemetry
  • Webhook Subscriptions
  • HMAC SHA-256 Signatures
  • Delivery Logs
  • Manual Retry Simulator
  • Network Latency Delay
  • HTTP Status Codes
  • Rate-Limit Simulator
    429
  • Flaky Network & Jitter
    Chaos
  • Session Quotas & Activity
  • JSON Snapshots
    JSON
  • Headless CI/CD Testing
    CI
  • Mobile QR Code Sync
  • System Metrics & Health
  • Atomic Sandbox Reset
  • Official TypeScript SDK
  • Multi-Language Generators
  • DevTools Extension
  • OpenAPI 3.1 Spec
    JSON
  • Postman Collection v2.1
  • Bruno Collection
  • Insomnia Workspace
  • TypeScript .d.ts
    .d.ts
  • AI Prompt Rules
    Rules
  • Context Index (llms.txt)
  • Full Schema (llms-full.txt)
  • Manifest (product.json)
  • All Feature Articles
    Blog
  • React CRUD Without Backend
    Deep Dive
  • Why Static APIs Fail
  • Mocking Stateful Auth
  • WebSockets & SSE Guide
Technical Blog
Articles

In-depth articles explaining stateful mock APIs, WebSockets, payments, and frontend resilience.

Read Articles
PreviousUsers Resource
NextComments Resource
Core REST Resource
100 Baseline Fixtures

Posts REST API & Data Model

Blog post articles containing title, body, user association, created dates, and full-text search indexing. Full CRUD simulation supporting persistent writes, relationship traversal, full-text filtering, and copy-on-write isolation per visitor session.

Full CRUD (GET, POST, PUT, PATCH, DELETE)Copy-on-Write Session OverlayRelational Sub-ResourcesFull-Text Search & Pagination

Live Posts Record Explorer

Live queries executed directly against GET /api/v1/posts.

IDTitleAuthor (user_id)Body ExcerptState
No records found matching query.
Page 1 of 1

Post Entity Schema & Field Dictionary

Exact property definitions, data types, nullability, and nested structures.

FieldTypeRequiredDescriptionExample
idnumber | stringRequiredPrimary key. Integer (1-100) or local-<uuid>.1
user_idnumber | stringRequiredForeign key referencing author users.id.1
titlestringRequiredPost headline. Indexed for full-text search (?q=...)."sunt aut facere repellat"
bodystringRequiredArticle content paragraph. Indexed for full-text search."quia et suscipit suscipit..."
created_atstringOptionalISO 8601 creation timestamp."2026-01-15T08:30:00.000Z"
_sandbox'created' | 'updated'OptionalSession mutation indicator added to modified records."created"

Entity Relationships & Nested Sub-Resources

Access related entities without multiple round trips using hierarchical REST sub-resource paths.

belongsTo

User

FK: user_id
GET /posts/:id/user

Author profile record associated with this article.

hasMany

Comments

FK: post_id
GET /posts/:id/comments

All discussion comments submitted on this post.

Copy-On-Write Sandbox Architecture

How stateful mutations persist during your test session without requiring database locks or affecting other developers.

1

Baseline Read-Only Layer

Every session starts with pristine baseline fixtures (25 users, 100 posts, 500 comments, 200 todos). These records are never permanently modified or locked.

2

Per-Visitor Overlay Tier

When you call POST, a local-<uuid> record is spawned. PUT / PATCH modifies your private overlay, and DELETE tags a tombstone marker.

3

Atomic Reset & Zero Lock

Sessions run in parallel with 100% isolation. A single call to POST /api/v1/sandbox/reset purges the overlay and restores clean initial data in <5ms.

Production Client Integration Recipes

Tested integration patterns for React Query, TypeScript Fetch, Axios, Python, and cURL:

1
// React 18+ with TanStack Query v5 & Optimistic Mutation
2
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
3
4
// 1. Fetch Paginated Collection
5
export function usePosts(page = 1, limit = 10, search = '') {
6
return useQuery({
7
queryKey: ['posts', page, limit, search],
8
queryFn: async () => {
9
const params = new URLSearchParams({ page: String(page), limit: String(limit) });
10
if (search) params.set('q', search);
11
12
const res = await fetch(https://playground.nileslabs.com/api/v1/posts?${params}`, {
13
credentials: 'include', // Includes visitor sandbox session
14
});
15
if (!res.ok) throw new Error('Failed to fetch posts');
16
return res.json();
17
},
18
});
19
}
20
21
// 2. Stateful Optimistic Create Mutation
22
export function useCreatePost() {
23
const queryClient = useQueryClient();
24
25
return useMutation({
26
mutationFn: async (newRecord) => {
27
const res = await fetch('https://playground.nileslabs.com/api/v1/posts', {
28
method: 'POST',
29
headers: { 'Content-Type': 'application/json' },
30
credentials: 'include',
31
body: JSON.stringify(newRecord),
32
});
33
if (!res.ok) throw new Error('Create failed');
34
return res.json();
35
},
36
onSuccess: () => {
37
// Invalidate query to merge new sandbox record at top of collection
38
queryClient.invalidateQueries({ queryKey: ['posts'] });
39
},
40
});
41
}

Interactive API Consoles (Posts)

Execute direct live requests against the sandbox API endpoints:

List All Posts

Retrieve a paginated list of posts. Results merge shared global posts with session sandbox overlays (newly created posts appear at the top).

GET
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Get Single Post

Retrieve details of a specific post by integer ID or local sandbox string ID.

GET
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Create Post

Create a new post in your session overlay. Capped at 30 custom created records per session.

POST
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Replace Post (PUT)

Replace an existing post record in the session overlay while preserving global baseline position.

PUT
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Partial Post Update (PATCH)

Update specific fields (such as title or body text) of an existing post.

PATCH
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Delete Post

Remove a post record from your session overlay view.

DELETE
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Get Post Comments Sub-Resource

Retrieve all comments linked relationally to a specific blog post.

GET
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}
Previous

Users Collection

Next

Comments Collection