← Back to list

Mocking API with Proxyman and ApiDog (Complete Tutorial)

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…

AI Rabbit · 2024-10-28 10:51 · 2 claps · 3.2 min read paywalled
#development #api #proxyman #apidog
Open on Medium ↗
Wiki topics: 💭 · Philosophy of Spirit

Mocking API with Proxyman and ApiDog (Complete Tutorial)

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** 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:

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.

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.

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:

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

  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.

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

  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.

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.


메타데이터
post_id
cceeb67d0ae3
slug
mocking-api-responses-to-save-costs-and-time-cceeb67d0ae3
url
https://medium.com/@airabbitX/mocking-api-responses-to-save-costs-and-time-cceeb67d0ae3
canonical_url
https://medium.com/@airabbitX/mocking-api-responses-to-save-costs-and-time-cceeb67d0ae3
author_url
https://medium.com/@airabbitX
status
ok
fetched_at
2026-09-12 03:17:22