Set up mock servers

Set up and utilize a mock server with OneTab. OneTab allows you to configure mock servers to aid in API development and testing. These servers imitate the actions of real API servers, accepting requests and providing responses. By integrating a mock server into your collection and including examples in your requests, you can replicate the behavior of an actual API.

When a request is submitted to a mock server, OneTab identifies a matching example in your collection and responds with the data associated with that example. To access existing mock servers within your workspace, navigate to the Mock Server section.



Mock Server Quick Start

To begin testing using a mock server in OneTab, follow these steps:

  1. Send a request to any API within OneTab and ensure that the request is saved to a collection.
  2. In the response pane, click on the Save Response button. OneTab will automatically populate the example with the response received when the request was sent.
  3. Navigate to the Mock server tab. Click on the plus icon and select select an existing collection.
  4. Provide a name for your mock server. Click on Done.
  5. Copy the mock URL provided and return to your request. Replace the base part of the URL with the mock server URL (everything before the path, such as up to /orders).
  6. Click on Send. OneTab will return the example response saved for the request, this time from the mock server.
  7. Edit the response as needed in the example, save it, and send the request again. OneTab will return your edited mock response.

Creating Mock Servers

You have the option to generate mock servers either from an existing collection or allow OneTab to create a new collection specifically for your mock server. You also have the flexibility to create a new mock server from scratch.

Creating a Mock from Scratch:

  1. Select Mock Server or select + or you can add new mock server tab by clicking on Create mock server button.
  2. Select an existing collection, or create a new collection and add an initial request.


Configuring Mock Server Details

To configure your new mock server, give it a name. Once you’ve finalized, click on Done.
OneTab will then provide you with the necessary details to utilize the mock server. You can access these details at any time by navigating to Mock Servers in the sidebar and selecting the specific mock server.

Click on the copy icon to begin making requests to your mock server.

To remove a mock server, navigate to Mock Servers in the sidebar. Then, click on the additional actions icon (…) located next to the name of the mock server and choose the option to Delete.

You can’t change the mock server’s collection. If you need to mock a different collection, create a new mock server.

Next Steps

To learn more about mock servers, see the following resources: