Conventions
Identifiers
Integer primary keys (1, 2, …) per collection. Foreign keys use the
<singular>Id camelCase pattern (userId, productId).
Naming
All JSON field names are camelCase. Collection identifiers in URLs are
kebab-case (e.g. /api/v1/order-items).
Timestamps
Collections that model audit timestamps expose createdAt and updatedAt
as ISO 8601 strings. Consult the collection schema because not every record type includes timestamps.
Pagination
List endpoints accept ?page=N&limit=M. Default limit is 25, max 100. Responses
include a meta object with page, limit, total, and totalPages. The links object contains self, first, last, next, and prev URLs. Invalid values fall back to
defaults or are clamped to the supported range.
Sorting
?sort=field for ascending, ?sort=-field for descending. Multi-key: ?sort=category,-price. Up to eight unique sort fields are applied in the order provided.
Filtering
- Exact match:
?status=delivered - Range:
?price_gte=10&price_lt=100 - In:
?status_in=pending,confirmed - Substring:
?title_like=spicy - Text search:
?q=…
Legacy compatibility
Compatibility routes preserve the request style of the legacy Example Data service (example-data.draftbit.com): root-level collection paths (/products, /products/3), snake_case
collection names (/product_reviews), nested relationships (/todo_lists/3/todos), and json-server params are accepted. This includes
_page, _limit, _start, _end,
_sort, _order, _embed, and
_expand, along with q and json-server field filters. The
/db snapshot route is also available. Legacy list responses return a bare JSON array
with the total in an X-Total-Count header when the request paginates or slices the
collection. The pristine seed is the database committed by the retired service on June 18, 2024,
so existing numeric, string, and UUID record URLs continue to resolve to the same records whenever
the shared test data is clean.
The compatibility routes accept GET, HEAD, POST,
PUT, PATCH, DELETE, and OPTIONS in the same
locations as json-server. Root-route mutations are temporarily shared by both Example Data hostnames,
so a successful write is visible to later list, detail, relationship, and
/db reads. This state is disposable test data, is returned automatically to the pristine
seed, and must not be used as an application database. JSON request bodies are capped at 64 KiB;
they may contain at most 32 levels of nesting and 4,096 JSON nodes (objects, arrays, and scalar
values). Writes that exceed a request, structure, or shared-state safety ceiling return
413 Payload Too Large. Dynamically generated legacy responses are capped at 8 MiB
of pretty JSON, including lists, detail responses, relationship expansions, and a changed /db snapshot. Use _limit, pagination, or a narrower filter if a read reaches that
ceiling.
These routes are deprecated (responses carry a Deprecation header) — use
/api/v1/… for new work. Compatibility covers routes, common json-server query parameters,
transport-level response shapes, seeded records, IDs, counts, relationships, mutation read-after-write
behavior, and legacy field names.