> ## Content Index
> Fetch the complete content index at: https://airabbit.blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# Mocking API with Proxyman and ApiDog (Complete Tutorial)
- URL: https://airabbit.blog/mockup-any-request/
- Published: 2024-10-28T10:49:51.000Z
- Updated: 2025-03-21T15:50:18.000Z
- Description: In this tutorial, learn how to efficiently mock API responses to save on costs and time during development. We'll guide you through setting up Proxyman, making requests with Apidog, enabling SSL interception, and capturing mock responses. This method allows for offline testing and faster response...
- Author: AiRabbit
- Tags: Tutorials, Development, Automation

As a **developer**, my application interacts with many **APIs**. For testing purposes, I often make the same calls repeatedly, and if the API is a **third-party service**, this can become **expensive** and **time-consuming**.

## Summary of the Steps

In this tutorial, we'll:

1. **Set up Proxyman** and install the required certificates.
2. **Make initial API requests** using **Apidog**.
3. **Configure the System Proxy** to collect responses.
4. **Enable SSL Interception** in Apidog.
5. **Fake the API Response** locally.
6. **Test and Verify** the faked response.

## Tools You'll Need

- [**jsonplaceholder**](https://jsonplaceholder.typicode.com/todos/?ref=airabbit.blog) to generate test data
- **Apidog** to query the API
- **Proxyman** to capture the request and response

## Step-by-Step Guide

### Step 1: Set Up Proxyman

1. **Open Proxyman** and enable it.

**Install the SSL certificate** as shown below:

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/image-159.png)

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/image-160.png)

### Step 2: Make Initial API Requests with Apidog

1. Run the API request in **Apidog**.

Observe that you receive a list of todos, and the request takes about **380ms**. Note that real APIs may take longer and incur costs per request.

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/1_modified-2.png)

### Step 3: Configure the System Proxy

1. Return to **Proxyman** and check the logs. You should see the request from Apidog. To avoid clutter, **filter the requests** to focus on Apidog's traffic.*Note:* At this stage, only the request is visible because **SSL** interception isn't enabled yet.

**Force the system proxy** to be used to capture responses in Proxyman.

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/2_modified-1.png)

### Step 4: Enable SSL Interception

1. On the **API consumer side** (Apidog), make the following changes:
  - Ensure Apidog uses the **system proxy**.
  - **Disable SSL verification** since a local fake **SSL certificate** is being used.

**Configure Proxy Settings** in Apidog:

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/image-163.png)

**Disable SSL Verification** in Apidog's request settings:

![Disable SSL Verification](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/image-162.png)

**Enable HTTPS Response** in Proxyman to intercept and view the response.

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/3_modified-1.png)

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/4-1.png)

### Step 5: Capture and Mock the API Response

1. **Run the same request** again in Apidog.
  - This will **cache** the request and **log** it for debugging.

**Enable Local Map** to start mocking incoming API requests to the specified endpoint.

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/image-164.png)

**Create a Local Map** in Proxyman to mock the response:

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/6-2.png)

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/7-1.png)

Go back to **Proxyman** to see the actual response after SSL interception.

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/5_modified.png)

### Step 6: Test and Verify the Mocked Response

1. **Run the same request** again in Apidog.
2. **Offline Testing:** You can now turn off your internet and still receive the same result in Apidog.

**Check Proxyman Logs** to confirm that the request is flagged as "edited," meaning it was intercepted and never reached the actual API.

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/11_modified.png)

You should receive the same result as before, but notice the reduced response time: **380ms** vs. **13ms**. This indicates the response is being mocked locally.

![](https://storage.ghost.io/c/b6/58/b65880bb-2a06-491e-bb4d-a6abeb13a649/content/images/2024/10/9_modified.png)

## Conclusion

In this tutorial, we created a **mockup for an API** to **debug** and **mock API requests**, thereby saving **traffic**, **costs**, and achieving full **transparency** in the communication between the consumer and the API.