Getting started
Getting started
URLs and versioning
Endpoints are grouped under /api/v1. Resources use plural nouns, records are addressed by numeric ID, and relationships are nested one level deep:
GET https://test.naimulhassan.me/api/v1/users
GET https://test.naimulhassan.me/api/v1/users/1
GET https://test.naimulhassan.me/api/v1/users/1/posts
GET https://test.naimulhassan.me/api/v1/posts/search?q=coffeeIDs are positive integers. A malformed ID such as /users/abc returns 400 INVALID_ID; a well-formed ID that does not exist returns 404 RESOURCE_NOT_FOUND.
JSON in, JSON out
Responses are JSON with Content-Type: application/json (except placeholder images, which are SVG). Request bodies must be JSON objects sent with Content-Type: application/json; other content types get 415, malformed JSON gets 400 INVALID_JSON, and bodies over 100 KB get 413.
Methods and status codes
| Method | Purpose | Success |
|---|---|---|
| GET | Read lists, single records, searches, and relations | 200 |
| POST | Create a record (simulated) | 201 |
| PUT | Replace a record with a complete body (simulated) | 200 |
| PATCH | Update some fields of a record (simulated) | 200 |
| DELETE | Delete a record (simulated) | 204 (empty body) |
Using a method a route does not support returns 405 METHOD_NOT_ALLOWED with an Allow header listing the supported methods.
Simulated writes
Users, products, posts, comments, and todos accept POST, PUT, PATCH, and DELETE. The API validates the body, checks that referenced records exist (for example a comment's postId), detects conflicts such as duplicate emails, and returns what the record would look like. Nothing is stored, so a follow-up GET returns the original data. Simulated responses include this header:
X-MockAPIs-Simulated: trueBuilding a CRUD app?
Keep created and edited records in your client state (or a local store) and use the API responses as the source of truth for IDs and validation.
Carts, recipes, and quotes are read-only.
Useful response headers
| Header | Meaning |
|---|---|
| X-Request-Id | Unique ID for the request. Also included in error bodies. You may send your own (8-64 letters, digits, ".", "_" or "-"). |
| X-Response-Time | Server processing time, e.g. 3.2ms. |
| X-MockAPIs-Simulated | Present on simulated writes. |
| RateLimit-Limit / -Remaining / -Reset | Your current rate-limit window. See Rate limits. |
| Retry-After | Seconds to wait, sent with 429 and 503 responses. |
About the data
Synthetic and deterministic
Every record is generated from a fixed seed, so the same request returns the same data on every deployment. Names are fictional, emails use example.com, and phone numbers use the reserved 555-01xx range. No real person's data is included.
Images
image and thumbnail fields point to deterministic SVG placeholders served by the API itself, so they never expire and do not depend on a third-party image host.
Next
Continue with Pagination & query params or jump into a resource such as Users.