格 千格 KiloCell

API Mock

Backend not ready? Mock REST responses in the browser so frontend work can continue without waiting.

Create a mock endpoint
Response (JSON)
Response headers
Quick templates:

Unblock frontend work when the API is not ready

Frontend and backend usually move in parallel. In practice the UI is often done while the API is still changing or offline. That is when a lightweight API mock helps.

The API contract is not finalized — how do you write frontend logic?

Approach: Agree on a basic data shape, then create a mock at /api/user/profile with the JSON you expect. Your fetch or axios calls can start immediately. Switch the base URL when the real API ships.

How do you test error states?

Approach: Real backends rarely emit 500 or 403 on demand. Create a mock that returns 500 and check that the page shows a clear “server busy” message.

What this tool does

  • Runs in the browser : Mock config stays in localStorage. Nothing is uploaded.
  • Dynamic variables : {{uuid}} for unique ids, {{random:1-100}} for random numbers.
  • Postman export : Export every mock as a Postman collection for the rest of the team.

Placeholders

Use these in the response body or headers:

  • {{uuid}} : random UUID
  • {{timestamp}} : current timestamp
  • {{date}} : current date string
  • {{random:min-max}} : random integer in that range
FAQ

Can fetch() call these endpoints?

In demo mode you can try them from the console. For real integration, export to Postman or a mock server. The page intercepts requests (or uses a service worker, depending on the setup).

Will my mocks disappear?

They stay in the browser’s localStorage until the cache is cleared. Export JSON for anything you need to keep.

Done