Apimimic - The API Mocking Tool

Mock simple REST API calls effortlessly. Emulate HTTP GET, POST, PUT, DELETE, PATCH, and other endpoint responses with a simple and easy-to-use interface.

Why Apimimic?

🚀 Fast: Automatically mock requests as you make them.

🔁 Proxy Requests: Forward requests to your real API while mocking specific ones.

⏱️ Response Time Control: Simulate real-world API latency for better frontend testing and user experience optimization.

🤖 AI-Powered Response Generation: Automatically generate mock response bodies.

🔄 Automatic CRUD: Smartly handles dynamic endpoints for RESTful operations.

📜 OpenAPI Support: Import OpenAPI specifications to generate endpoints.

🎨 Simple UI: An intuitive interface that makes it easy to manage API mocks.

Getting Started

Step 1: Accessing Apimimic

  • Navigate to Apimimic Dashboard.
  • Log in or create an account.
  • The dashboard will display an API URL.
    https://your-api-url.apimimic.com
  • Every request made to this base URL will be logged and visible in the dashboard.

Step 2: Making Requests

Apimimic automatically logs API requests. To create a new request, simply make an actual request to the API URL. Some examples:

curl -X GET "https://your-api-url.apimimic.com/article"
curl -X POST "https://your-api-url.apimimic.com/article"   -H "Content-Type: application/json"   -d '{ "title": "My First Article" }'
curl -X GET "https://your-api-url.apimimic.com/customer/542"
curl -X PUT "https://your-api-url.apimimic.com/customer/542"   -H "Content-Type: application/json"   -d '{ "name": "John Doe" }'
curl -X DELETE "https://your-api-url.apimimic.com/customer/542"

Step 3: Configuring Response Details

For each endpoint, you can configure specific response behaviors:

HTTP Status Codes

  • Enter a custom status code or one from common status codes:
    • 2xx codes (200 OK, 201 Created, 204 No Content)
    • 4xx codes (400 Bad Request, 401 Unauthorized, 404 Not Found)
    • 5xx codes (500 Internal Server Error, 503 Service Unavailable)
  • This helps simulate various API response scenarios for better error handling testing.

Response Time

  • Set a delay duration in milliseconds (e.g., 200ms, 1000ms).
  • Benefits of simulating response times:
    • Test loading states in your UI
    • Verify timeout handling
    • Simulate slow network conditions
    • Optimize user experience for varying response times

Pro Tip: Use different response times for different endpoints to simulate realistic API behavior. For example, use shorter delays for simple GET requests and longer delays for complex operations.

Editing Response Body & AI-Powered Generation

You can manually edit the mocked response body or generate mock data using AI.

  • Click "Body" next to an endpoint.
  • Enter a JSON response manually or click Generate with AI.
    • If the body is empty, AI will generate new content.
    • If there's existing content, AI will append additional items (e.g., new objects in an array).
  • Click Save Changes.

✅ Note: AI-powered generation only applies to response bodies, not headers.

Editing Response Headers

Modify response headers for your mocked API requests:

  • You can either edit Project Headers (for all endpoints) or Endpoint Headers (for a specific endpoint).
  • Click "Headers" next to an endpoint.
  • Add key-value pairs (e.g., access-control-allow-origin: *).
  • Click Save.

CORS Headers

When your frontend application makes requests to the mock API, you might need to configure CORS headers to allow cross-origin requests. Here are the important headers to consider:

  • access-control-allow-origin: Set this to your frontend's URL (e.g., http://localhost:3000) or * for development. Using * in production is not recommended for security reasons.
  • access-control-allow-credentials: Set to true if your requests include credentials
  • access-control-allow-methods: Specify allowed HTTP methods (e.g., GET, POST, PUT, DELETE, PATCH)
  • access-control-allow-headers: List allowed headers (e.g., content-type, authorization)

Consider adding these headers to your Project Headers.

Automatic CRUD Mode

Apimimic provides automatic CRUD handling for dynamic endpoints.

How It Works

  • Works only with dynamic IDs in the URL (numbers or UUIDs).
    • Example: /article/5
    • Example: /article/21b24ee2-bbb5-4a73-aa77-e69de8114985
    • Example: /article/new-entry ❌ (won't trigger automatic CRUD)
  • Works one level deep.
    • Example: /article/5/comments/2 ❌ (too deep, changes only comments, not article)
    • Example: /article/5 ✅ (valid)
  • Intelligently modifies data arrays in response bodies:
    • POST: Adds the new entry to the array.
    • GET (with ID): Retrieves the correct entry.
    • PUT: Updates the correct entry in the array.
    • DELETE: Removes the entry from the array.
  • There's no specific requirement for data array naming. It can be "data", "article", "items", or anything else.

Example: Automatic CRUD in Action

1️⃣ Creating a New Article (POST)

curl -X POST "https://your-api-url.apimimic.com/article" 
     -H "Content-Type: application/json" 
     -d '{ "title": "My First Article", "content": "Hello world!" }'

✅ Apimimic automatically adds this to the response array.

2️⃣ Retrieving an Article (GET)

curl -X GET "https://your-api-url.apimimic.com/article/5"

✅ Apimimic returns the corresponding entry from the array.

3️⃣ Updating an Article (PUT)

curl -X PUT "https://your-api-url.apimimic.com/article/5"
     -H "Content-Type: application/json" 
     -d '{ "title": "Updated Article", "content": "Updated content!" }'

✅ Apimimic finds the article in the array and updates it.

4️⃣ Deleting an Article (DELETE)

curl -X DELETE "https://your-api-url.apimimic.com/article/5"

✅ Apimimic removes the entry from the array.

Bulk Editing Endpoints

You can manage all endpoints at once:

  • Click Bulk Edit in the Dashboard.
  • Choose an action:
    • Proxy all endpoints - All endpoints are set to proxy mode
    • Mock all endpoints - All endpoints are mocked
    • Import OpenAPI specification - Import OpenAPI specification
    • Delete all endpoints

Conclusion

You are now ready to mock APIs, forward requests, and modify responses using Apimimic! 🎉