{% extends "base.html" %} {% block title %}{{ action }} Endpoint - Mock API Admin{% endblock %} {% block content %}

{{ action }} Endpoint

Configure a mock API endpoint.

{% if error %} {% endif %}
{% if endpoint and endpoint.id %} {% endif %}
{{ errors.route if errors and errors.route else 'Route must start with / and contain no consecutive slashes or ..' }}
The path for the endpoint, e.g., /api/users or /api/users/{id}.
{{ errors.method if errors and errors.method else 'Please select a valid HTTP method.' }}
{{ errors.response_body if errors and errors.response_body else 'Response body is required.' }}
Jinja2 template. Available variables: path_*, query_*, header_*, body_*, timestamp, datetime, request_id, method, url, client_host, and any custom variables defined below.
{{ errors.response_code if errors and errors.response_code else 'Response code must be between 100 and 599.' }}
{{ errors.content_type if errors and errors.content_type else 'Content-Type header value.' }}
{{ errors.delay_ms if errors and errors.delay_ms else 'Artificial delay in milliseconds (0‑30000).' }}
Inactive endpoints will not be registered as routes.
{{ errors.variables if errors and errors.variables else 'Must be valid JSON.' }}
Default template variables as a JSON object. Will be merged with request context.
{{ errors.headers if errors and errors.headers else 'Must be valid JSON.' }}
Additional headers to include in the response, e.g., {"X-Custom-Header": "value"}.
Cancel
Help
Route Parameters

Use {param} in the route to capture path parameters. Example: /api/users/{id} will make id available as {{ '{{ id }}' }} or {{ '{{ path_id }}' }}.

Template Variables
  • path_* – path parameters
  • query_* – query parameters
  • header_* – request headers
  • body_* – request body fields (if JSON)
  • timestamp – Unix timestamp
  • datetime – formatted date/time
  • request_id – unique request ID
Example Response Body
{
  "id": {{ '{{ path_id }}' }},
  "name": "User {{ '{{ path_id }}' }}",
  "timestamp": {{ '{{ timestamp }}' }},
  "query": {{ '{{ query_search }}' | default('null') }}
}
{% endblock %} {% block extra_scripts %} {% endblock %}