Cloud-based mocks let you simulate API responses by hosting mock data online instead of running a local server. With Requestly’s File Server, you can upload mock files (like JSON or HTML) and redirect real API requests to these files. It’s a fast, shareable, and reliable way to mock backend APIs—perfect for frontend development or testing in isolation.
How to Create a Cloud-based Mock
To create a cloud mock, you’ll first create a file on the File Server and then set up a Redirect Rule to serve it in place of a real API.
Step 1: Create a File on Requestly’s File Server
Open the File Server:
From the Requestly Dashboard, go to the Files tab in the sidebar.
Click "New File" or Upload:
Choose New File to create one from scratch, or upload an existing JSON file.
Configure the File and save the file:
Give it a descriptive name and fill in the following options:
-
Method: HTTP method to match (GET, POST, etc.)
-
Status: Response code (e.g. 200 OK)
-
Content Type: e.g.
application/json
-
Latency (optional): Simulate response delay
-
Endpoint: Define a unique URL path
-
Response Body: Add your mock JSON/text
-
Headers (optional): Add custom response headers
-
Password Protection (optional): Secure with a query param password
Step 2: Redirect API Requests to the File Server
Create a Redirect Rule:
Go to HTTP Rules → + New Rule → Redirect Rule.
Name the Rule:
Give your rule a clear name and optional description.
Set the Source Condition
Define when the rule should trigger. Use filters like URL Contains, Equals, Regex, or Advanced Filters.
💡 Example:
Match the bakery products API in the Requestly Playground:
Set the Redirect Target:
Paste the File Server URL copied earlier. You can also select the file directly from your File Server.
Save and Enable the Rule:
Click Save and toggle the rule ON to activate it.