Mocking API with Proxyman and ApiDog (Complete Tutorial)
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...

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:
- Set up Proxyman and install the required certificates.
- Make initial API requests using Apidog.
- Configure the System Proxy to collect responses.
- Enable SSL Interception in Apidog.
- Fake the API Response locally.
- Test and Verify the faked response.
Tools You'll Need
- jsonplaceholder 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
- Open Proxyman and enable it.
Install the SSL certificate as shown below:


Step 2: Make Initial API Requests with Apidog
- 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.

Step 3: Configure the System Proxy
- 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.

Step 4: Enable SSL Interception
- 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:

Disable SSL Verification in Apidog's request settings:

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


Step 5: Capture and Mock the API Response
- 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.

Create a Local Map in Proxyman to mock the response:


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

Step 6: Test and Verify the Mocked Response
- Run the same request again in Apidog.
- 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.

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.

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.