Skip to main content

Creating a Mocked API

Legacy Documentation
You're viewing legacy documentation for API Fortress (deployed via an on-premises container). To view documentation for the new SaaS version of API Fortress now known as Sauce Labs API Testing and Monitoring (with Sauce Connect tunnels) see API Testing on the Sauce Labs Cloud.

The Mocking Tool is a great way to test and define new endpoints.

Step 1 - Access the Mocking Tool

The Mocking Tool is accessed by clicking on the "Tools" menu in the top navigation bar and clicking "Mocking."

Access Mocking Tool

Step 2 - Create a New Mock Endpoint

Click either the green "New Endpoint" button or the "+ New Endpoint" button highlighted in the image below to create a new endpoint.

Create a Mock Endpoint

Step 3 - Define the New Endpoint

Use the "Create Entry" modal to define the domain and path for the mock endpoint.

Define a New Endpoint

Click "Continue", and your new endpoint will be populated in the Domains List.

Populate Domain Lists

Step 4 - Define the Response

Click "+Add Response Case" highlighted below.

Define the Response

Choose the method (REST verb), define any parameters, choose the content type, status code and enter an optional description. You can define any necessary key/value header pairs in the "Headers" section.

Finally, define the response payload in the provided space.

Define the Payload

NOTE: To learn more about the Expressions field click here.

Step 5 - Test the Endpoint

Switch to the HTTP client of your choice and enter the address for the endpoint you just created. The response should match the response you set up when you created the mock endpoint. This endpoint is now prepared for use.

Define the Payload