← Questions
Design REST APIs for storing JSON files
0
I was asked this
No reports yet. Sign in to say where you were asked it.
A system design interview question asked in Microsoft's system design round, last asked Jan 2026. It tests rest apis, storage and api design.
Design the REST API and the backend for a service that stores and serves JSON documents for many users and applications: create, read, update (whole or partial) and delete documents, list them, and keep versions. Documents range from tiny to very large.
Requirements
- Functional: CRUD on JSON documents organised by owner or collection; partial updates; listing with pagination and filters on metadata; version history and reading an old version; access control per document or collection.
- Non-functional: safe concurrent updates (no lost writes); large documents handled without timeouts; high read throughput; durable storage.
Clarifying questions
- How large can a document be, and how many documents per user?
- Do clients query inside documents, or only by id and metadata?
- How many versions are kept, and for how long?
- Who are the clients (browsers, services), and how do they authenticate?
- Is schema validation required?
What a strong answer covers
- Resource design:
POST /collections/{c}/documents,GET,PUTandPATCH /documents/{id}(JSON Merge Patch or JSON Patch),DELETE,GET /documents/{id}/versions/{v}, with status codes and error bodies. - Optimistic concurrency with
ETagandIf-Match, returning412on a conflict, so two writers cannot silently overwrite each other. - Storage split: metadata (id, owner, size, version, hash, timestamps) in a database, and document bodies in object storage once they are large; immutable versions keyed by
id/version. - Large files: upload and download in chunks or via pre-signed URLs, compression, and streaming reads.
- Listing with cursor pagination, filters on metadata, and indexes that support them.
- Authentication, authorization checks per request, rate limits and quotas, plus caching of reads with ETags.
Follow-ups
- Two clients PATCH different fields of the same document at once. Should both succeed?
- Add a query API over fields inside the documents.
- Support documents of 5 GB.
- Purge a user's data entirely, including every version and backup.
Where it's asked
- Microsoft · System design · Last asked Jan 202660 min · Design discussion
What it tests
rest apis · storage · api design
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
