Record and Mock Flaky APIs in bulk

Getting Started
Installation
Setup
Inspect Traffic
HTTP Rules (Modify Traffic)
Session Book
Mock Server
API Client
File Server
Workspace
Public API
Guides
TroubleShooting
Subscription & Billing
Getting Started
Installation
Setup
Inspect Traffic
API Client
HTTP Rules (Modify Traffic)
Mock Server
File Server
Workspace
Public API
Guides
Session Book
Subscription & Billing
TroubleShooting
 
This guide provides detailed instructions on how to use Requestly for mocking API requests to ensure reliable development workflows.
Mocking will be accomplished using the Modify Response rule, which allows overriding the response of an API.
 
🆕
This feature is in BETA and available only on the Desktop App. Request early access

Recording traffic

  1. Connect an App: Launch a new app or connect an existing app with Requestly to start intercepting network traffic. Learn more here.
  1. Capture Network Traffic: Perform actions in your app to generate network traffic. Monitor and review this traffic within Requestly.
    1. notion image
  1. Save and Navigate to the Captured Session: Once all desired requests are captured, save this data as a session and proceed to the session details.

Creating Mocks

  1. Create Mocks from the Session: Click on 'Create Mocks from this Session' button. Then, select the type of APIs you want to mock.
    1. notion image
      • For REST APIs: Filter and select the requests you wish to mock.
      • For GraphQL APIs: Apply a Payload Filter to find specific requests containing the desired key. Then, filter and select the requests you wish to mock.
      notion image
  1. Specify Matching Conditions to Create Rules: Define the rules for mocking by choosing matching conditions such as matching the entire URL, only the path, or both path and query parameters. Review the created rules in the rules index.
    1. notion image

Testing the Mocks

  1. Navigate to the Traffic Interceptor: Use the sidebar to access the traffic interceptor section and reconnect your app.
  1. Retrace your flow to Test Mocks: Retrace the actions in your app to test the behaviour of the mocked requests. Look for highlighted requests in the logs, which indicate modifications by the mocking rules.
    1. notion image
  1. Review and Edit Rules: Click on the applied rules icon on any modified request to view or edit the rule definitions directly.
This process ensures a consistent development environment, as the APIs always return the expected responses and thus you gain independence from the current status of the API/service.
 
Note:
The current system can't handle the large volume of rules created in bulk, which in certain cases prevents users from creating multiple mocks when many mocks already exist. This is a technical debt, and we are working on a fix for upcoming releases. If you encounter this issue, you can use this workaround to continue testing.
We recommend backing up your rules in advance. To do this, select all your rules and click on the "Share Rules" button. Then, choose the option to download the rules to obtain a local copy.
A simpler way could be to delete the rules that you no longer need. If you are still not able to create mocks, please turn off syncing in the Global Settings.
Disabling syncing will allow you to create as many rules as you need. However, be aware that your rules will be local and not synced across your devices.