Mock APIs with Map Local
Map Local basics: your first mock
Answer a URL with your own response, without touching the server.
Map Local answers a request with a response you define. The real server is not called. Use it to build a screen before the API exists, test error states, or freeze data for a demo.
Create your first rule
- Open Map Local in AegisCeptor.
- Click + New.
- Fill in the rule:
- URL pattern
example.com/api/me- Method
GET(leave empty for any method)- Status code
200- Content-Type
application/json; charset=utf-8
- Paste a response body:
{ "id": "u_1001", "name": "Demo User", "email": "demo@example.com", "plan": "pro" } - Open
https://example.com/api/mein a captured browser. You get your JSON, and the request is marked as mocked in the traffic list.
Rules apply within about a second; you do not need to restart anything.
URL patterns
| Pattern | Matches | Does not match |
|---|---|---|
example.com/api/products | that path, with any query: /api/products?page=2 | /api/products/42 |
example.com/api/products?page=2 | only that exact query | ?page=3 |
example.com/api/banners/* | anything under it: /api/banners/home | /api/banner |
*.example.com/api/* | any subdomain | other domains |
example.com/api/products/:id | /api/products/42, with id = 42 | /api/products/42/reviews |
/api/products/:id | the same path on any host | |
/\/api\/v\d+\/me/ | a regular expression (between slashes) | |
products | any URL that contains the text |
Matching ignores upper and lower case. https:// is optional. When two rules match, an exact match wins over a host/path rule that only matched because the query was ignored.
Other fields
- Delay (ms)
- Wait before answering, for example
3000to test loading states. - Headers
- Extra response headers, one
Name: valueper line. - Local file
- Serve a file from your Mac instead of the body, for example a large JSON or an image. See Files and sharing.
- Folder
- Group rules by feature or project. Toggle a whole folder on or off at once, and export it to share.
Good to know: mocked responses include
Cache-Control: no-store so the browser does not cache them, and the right CORS headers so web apps on another origin can read them.Next
- Several responses for one URL: success, error and empty states picked by conditions.
- Dynamic values: ids, dates and values copied from the request.
- Import a complete demo and try every feature in five minutes.