Skip to content
YKTechHubInc

Developer

Mock data.

Sample people, posts, and products you can call while testing an app.

A laptop open on a desk, with a plant and a yellow mug beside it.

Pictures

160 by 160 placeholder300 by 120 placeholder90 by 160 placeholder128 by 160 placeholder

Addresses

{
  "id": 1,
  "slug": "electronics",
  "name": "Electronics",
  "width": 1200,
  "height": 630,
  "image": "/mock/img/1200x630",
  "count": 3,
  "products": [
    {
      "id": 1,
      "name": "Pocket phone",
      "price": 429,
      "category": "electronics",
      "width": 400,
      "height": 400,
      "image": "/mock/img/400x400"
    },
    {
      "id": 2,
      "name": "Studio headphones",
      "price": 89,
      "category": "electronics",
      "width": 800,
      "height": 600,
      "image": "/mock/img/800x600"
    },
    {
      "id": 3,
      "name": "Compact keyboard",
      "price": 74,
      "category": "electronics",
      "width": 1200,
      "height": 480,
      "image": "/mock/img/1200x480"
    }
  ]
}

How to call it

No key. Any site can call these. A normal read is cached for a day. A write is not.

Lists and one record

Lists are /mock/users, /mock/posts, /mock/comments, /mock/products, and /mock/categories. One record adds the id: /mock/users/1. A category also accepts its slug, as in /mock/categories/electronics.

Filters

userId, postId, and category keep the matching records. q searches the fields. limit is at most 100. offset skips that many records. A list answers with data, total, limit, and offset.

Pictures

/mock/img/640x480 returns an SVG. Width and height run from 16 to 2000. status and delay do not apply to pictures.

Writes

POST /mock/products with a JSON body. The same JSON comes back with HTTP 201, and the list does not change. PUT /mock/users/1 returns the body you sent. DELETE /mock/users/1 returns that body, or deleted and the id when you send none. The next read still has the original record. The body is 100000 characters or fewer.

Failures

status sets the HTTP status and still returns the same JSON. Use an integer from 200 to 599. 204, 205, and 304 are refused, because they cannot carry JSON. delay waits that many milliseconds, up to 10000, then returns the same JSON. Both can be used together: /mock/products?status=503&delay=1500.

A missing collection or record is 404. status and delay do not change that. A simulated response is not cached.