Mock Server

Mock Server

mocks.chapar.rest is a free, public mock API you can use to try Chapar, or any other API client, without running a server of your own. The same server speaks REST and gRPC, and GraphQL, WebSocket and MQTT support are planned.

ProtocolAddressContract
RESThttps://mocks.chapar.rest/api/v1OpenAPI spec
gRPCmocks.chapar.rest:443 (TLS)Proto files

It offers two kinds of endpoints:

  • Todos: an in-memory todo list with full create, read, update and delete support, for trying out real request flows.
  • Utilities: endpoints that echo your request back, return any status code, wait, check credentials, set cookies, redirect, accept uploads and stream responses, for checking how a client behaves.

Use it from Chapar

The quickest start is to import the server’s contracts. See Import And Export Data:

  1. REST: import the OpenAPI spec to get a ready-made request for every endpoint.
  2. gRPC: import the proto files (todo.proto and utility.proto) and point the requests at mocks.chapar.rest:443.

Then create an environment with two variables:

VariableValue
baseUrlhttps://mocks.chapar.rest/api/v1
sessionIdany name of your own, e.g. alice-laptop

Send X-Session-Id: {{sessionId}} with your todo requests (as x-session-id metadata for gRPC) to get a private todo list.

Sessions

Todos belong to a session, chosen by the X-Session-Id header (REST) or the x-session-id metadata (gRPC):

  • Requests with the same session id share one todo list. Requests without one use the shared public session, which anyone can change.
  • A session id is 1-64 characters of letters, digits, ., _ or -.
  • A new session starts with three sample todos, so your first list request already returns data. POST /todos/reset (or the ResetTodos RPC) puts them back.
  • REST and gRPC share the same data: a todo created over gRPC can be read over REST with the same session id.
All data lives in memory. A session is deleted after one hour without requests, and everything is lost whenever the server restarts. Don’t store anything you want to keep.

Limits

The server is shared by everyone, so it enforces these limits:

LimitValueWhen exceeded
Request rate10 requests/second per client, bursts up to 30429 Too Many Requests
Concurrent requests10 per client, including open streams429 Too Many Requests
Todos per session100409 Conflict / RESOURCE_EXHAUSTED
Active sessions1000 (the public session is always available)503 Service Unavailable / UNAVAILABLE
Request body10 MiB400 Bad Request

The server is open source at chapar-rest/mock-server. You can also run it locally with go run ./cmd/server (it needs MOCK_ENV=local) and use http://localhost:8080/api/v1 without any limits.